Class AccumulatorIIAR
java.lang.Object
com.scivicslab.pojoactor.core.ActorRef<Accumulator>
com.scivicslab.pojoactor.workflow.IIActorRef<Accumulator>
com.scivicslab.pojoactor.workflow.accumulator.AccumulatorIIAR
- All Implemented Interfaces:
CallableByActionName,AutoCloseable
Interpreter-interfaced actor reference for
Accumulator implementations.
This class provides a common IIActorRef implementation for all Accumulator types. The actual accumulation behavior is determined by the POJO passed to the constructor.
Supported Actions
add- Adds a result (requires JSON object with source, type, data)getSummary- Returns formatted summary of all resultsgetCount- Returns the number of added resultsclear- Clears all accumulated results
Example Workflow Usage
steps:
- states: ["0", "1"]
actions:
- actor: accumulator
method: add
arguments:
source: "node-1"
type: "cpu"
data: "Intel Xeon"
- Since:
- 2.8.0
- Author:
- devteam@scivics-lab.com
-
Field Summary
Fields inherited from class com.scivicslab.pojoactor.core.ActorRef
actorName, actorSystem, object -
Constructor Summary
ConstructorsConstructorDescriptionAccumulatorIIAR(String actorName, Accumulator object, IIActorSystem system) Constructs a new AccumulatorIIAR. -
Method Summary
Modifier and TypeMethodDescriptioncallByActionName(String actionName, String arg) Executes an action identified by its name with the given arguments.Methods inherited from class com.scivicslab.pojoactor.core.ActorRef
ask, ask, askNow, clearJsonState, clearPendingMessages, close, createChild, getJsonBoolean, getJsonInt, getJsonString, getJsonString, getName, getNamesOfChildren, getParentName, hasJson, hasJsonState, initLogger, isAlive, json, putJson, setParentName, system, tell, tell, tellNow
-
Constructor Details
-
AccumulatorIIAR
Constructs a new AccumulatorIIAR.- Parameters:
actorName- the name of this actorobject- the Accumulator implementationsystem- the actor system
-
-
Method Details
-
callByActionName
Description copied from class:IIActorRefExecutes 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- Specified by:
callByActionNamein classIIActorRef<Accumulator>- Parameters:
actionName- the name of the action to executearg- string arguments to pass to the action (format defined by implementation)- Returns:
- an
ActionResultindicating success or failure and any result data
- Comma-separated values:
-