Class DynamicActorLoaderActor
java.lang.Object
com.scivicslab.pojoactor.workflow.DynamicActorLoaderActor
- All Implemented Interfaces:
CallableByActionName
Generic actor that dynamically loads and creates other actors from plugins.
This actor enables workflows to load actors from external JAR files or ServiceLoader providers at runtime, without restarting the application.
Supported Actions:
- loadFromJar: Load actor from external JAR file
- createFromProvider: Create actor from ServiceLoader provider
- listProviders: List all available ActorProvider instances
- loadProvidersFromJar: Load ActorProvider plugins from JAR
Example Workflow (Loading from JAR):
<workflow name="dynamic-loading">
<matrix>
<transition from="init" to="loaded">
<action actor="loader" method="loadFromJar">
/plugins/my-actor.jar,com.example.MyActor,myactor
</action>
</transition>
<transition from="loaded" to="done">
<action actor="myactor" method="someAction">args</action>
</transition>
</matrix>
</workflow>
Example Workflow (Loading from ServiceLoader):
<workflow name="service-loader">
<matrix>
<transition from="init" to="loaded">
<action actor="loader" method="createFromProvider">
math,mathactor
</action>
</transition>
<transition from="loaded" to="done">
<action actor="mathactor" method="add">5,3</action>
</transition>
</matrix>
</workflow>
- Since:
- 2.6.0
- Author:
- devteam@scivics-lab.com
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDynamicActorLoaderActor(IIActorSystem system) Constructs a new DynamicActorLoaderActor. -
Method Summary
Modifier and TypeMethodDescriptioncallByActionName(String actionName, String args) Executes an action identified by its name with the given arguments.
-
Field Details
-
system
-
-
Constructor Details
-
DynamicActorLoaderActor
Constructs a new DynamicActorLoaderActor.- Parameters:
system- the actor system to register newly loaded actors
-
-
Method Details
-
callByActionName
Description copied from interface:CallableByActionNameExecutes an action identified by its name with the given arguments.Implementations should parse the
argsstring according to their own conventions. Common approaches include:- Comma-separated values:
"5,3" - JSON:
"{\"a\":5,\"b\":3}" - Key-value pairs:
"a=5,b=3"
The method should return an
ActionResultindicating success or failure, along with any result data serialized as a string.- Specified by:
callByActionNamein interfaceCallableByActionName- Parameters:
actionName- the name of the action to executeargs- string arguments to pass to the action (format defined by implementation)- Returns:
- an
ActionResultindicating success or failure and any result data
- Comma-separated values:
-