Class LoggingAccumulatorIIAR
java.lang.Object
com.scivicslab.pojoactor.core.ActorRef<com.scivicslab.pojoactor.core.accumulator.Accumulator>
com.scivicslab.pojoactor.workflow.IIActorRef<com.scivicslab.pojoactor.core.accumulator.Accumulator>
com.scivicslab.actoriac.LoggingAccumulatorIIAR
- All Implemented Interfaces:
com.scivicslab.pojoactor.core.CallableByActionName, AutoCloseable
public class LoggingAccumulatorIIAR
extends com.scivicslab.pojoactor.workflow.IIActorRef<com.scivicslab.pojoactor.core.accumulator.Accumulator>
Accumulator actor reference that also logs to H2 database.
This class extends the standard accumulator functionality to also write logs to the H2LogStore for persistent storage. Each node's output is stored with the node ID for later querying.
Supported Actions
add- Adds a result and logs to databasegetSummary- Returns formatted summary of all resultsgetCount- Returns the number of added resultsclear- Clears all accumulated results
- Since:
- 2.9.0
- Author:
- devteam@scivics-lab.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Loggerprivate final DistributedLogStoreprivate final longFields inherited from class com.scivicslab.pojoactor.core.ActorRef
actorName, actorSystem, object -
Constructor Summary
ConstructorsConstructorDescriptionLoggingAccumulatorIIAR(String actorName, com.scivicslab.pojoactor.core.accumulator.Accumulator object, com.scivicslab.pojoactor.workflow.IIActorSystem system, DistributedLogStore logStore, long sessionId) Constructs a new LoggingAccumulatorIIAR. -
Method Summary
Modifier and TypeMethodDescriptioncom.scivicslab.pojoactor.core.ActionResultcallByActionName(String actionName, String arg) private com.scivicslab.pojoactor.core.ActionResultHandles the add action.private com.scivicslab.pojoactor.core.ActionResultHandles the clear action.private com.scivicslab.pojoactor.core.ActionResultHandles the getCount action.private com.scivicslab.pojoactor.core.ActionResultHandles the getSummary action.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
-
Field Details
-
logger
-
logStore
-
sessionId
-
-
Constructor Details
-
LoggingAccumulatorIIAR
public LoggingAccumulatorIIAR(String actorName, com.scivicslab.pojoactor.core.accumulator.Accumulator object, com.scivicslab.pojoactor.workflow.IIActorSystem system, DistributedLogStore logStore, long sessionId) Constructs a new LoggingAccumulatorIIAR.- Parameters:
actorName- the name of this actorobject- the Accumulator implementationsystem- the actor systemlogStore- the distributed log store for database loggingsessionId- the session ID for this workflow execution
-
-
Method Details
-
callByActionName
- Specified by:
callByActionNamein interfacecom.scivicslab.pojoactor.core.CallableByActionName- Specified by:
callByActionNamein classcom.scivicslab.pojoactor.workflow.IIActorRef<com.scivicslab.pojoactor.core.accumulator.Accumulator>
-
handleAdd
private com.scivicslab.pojoactor.core.ActionResult handleAdd(String arg) throws ExecutionException, InterruptedException Handles the add action.Adds the result to the accumulator (for console output) and also logs to the H2 database for persistent storage.
- Parameters:
arg- JSON object with source, type, and data fields- Returns:
- ActionResult indicating success or failure
- Throws:
ExecutionExceptionInterruptedException
-
handleGetSummary
private com.scivicslab.pojoactor.core.ActionResult handleGetSummary() throws ExecutionException, InterruptedExceptionHandles the getSummary action.- Returns:
- ActionResult with the formatted summary
- Throws:
ExecutionExceptionInterruptedException
-
handleGetCount
private com.scivicslab.pojoactor.core.ActionResult handleGetCount() throws ExecutionException, InterruptedExceptionHandles the getCount action.- Returns:
- ActionResult with the count
- Throws:
ExecutionExceptionInterruptedException
-
handleClear
private com.scivicslab.pojoactor.core.ActionResult handleClear() throws ExecutionException, InterruptedExceptionHandles the clear action.- Returns:
- ActionResult indicating success
- Throws:
ExecutionExceptionInterruptedException
-