Class LogStoreActor

java.lang.Object
com.scivicslab.pojoactor.core.ActorRef<DistributedLogStore>
com.scivicslab.turingworkflow.workflow.IIActorRef<DistributedLogStore>
com.scivicslab.turingworkflow.plugins.logdb.LogStoreActor
All Implemented Interfaces:
com.scivicslab.pojoactor.core.CallableByActionName, AutoCloseable

public class LogStoreActor extends com.scivicslab.turingworkflow.workflow.IIActorRef<DistributedLogStore>
Actor wrapper for DistributedLogStore.

This actor centralizes all database writes for logging. It should be created under ROOT and used by all accumulator actors in the system.

Actor Tree Position

 ROOT
 ├── logStore              <-- this actor
 ├── accumulator           (system-level)
 └── nodeGroup
     ├── accumulator       (workflow-level)
     └── node-*
 

Supported Actions

  • log - Log a message with level
  • logAction - Log an action result
  • startSession - Start a new workflow session
  • endSession - End a workflow session
  • markNodeSuccess - Mark a node as succeeded
  • markNodeFailed - Mark a node as failed
Since:
1.0
Author:
devteam@scivicslab.com
  • Field Summary

    Fields inherited from class com.scivicslab.pojoactor.core.ActorRef

    actorName, actorSystem, object
  • Constructor Summary

    Constructors
    Constructor
    Description
    LogStoreActor(String actorName, DistributedLogStore logStore, com.scivicslab.turingworkflow.workflow.IIActorSystem system, ExecutorService dbExecutor)
    Constructs a new LogStoreActor.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.scivicslab.pojoactor.core.ActionResult
    Ends a workflow session with a terminal status.
    Gets the dedicated executor service for DB writes.
    com.scivicslab.pojoactor.core.ActionResult
    log(String arg)
    Logs a message with level.
    com.scivicslab.pojoactor.core.ActionResult
    Logs an action result with execution metadata.
    com.scivicslab.pojoactor.core.ActionResult
    Marks a node as failed in the current session.
    com.scivicslab.pojoactor.core.ActionResult
    Marks a node as succeeded in the current session.
    com.scivicslab.pojoactor.core.ActionResult
    Starts a new workflow session.

    Methods inherited from class com.scivicslab.turingworkflow.workflow.IIActorRef

    callByActionName, hasAnnotatedAction, invokeAnnotatedAction, parseFirstArgument

    Methods inherited from class com.scivicslab.pojoactor.core.ActorRef

    ask, ask, askNow, clearJsonState, clearPendingMessages, close, createChild, expandVariables, getJsonBoolean, getJsonInt, getJsonString, getJsonString, getLastResult, getName, getNamesOfChildren, getParentName, hasJson, hasJsonState, initLogger, isAlive, json, putJson, setLastResult, setParentName, system, tell, tell, tellNow, toStringOfJson, toStringOfYaml

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LogStoreActor

      public LogStoreActor(String actorName, DistributedLogStore logStore, com.scivicslab.turingworkflow.workflow.IIActorSystem system, ExecutorService dbExecutor)
      Constructs a new LogStoreActor.
      Parameters:
      actorName - the name of this actor (typically "logStore")
      logStore - the DistributedLogStore implementation
      system - the actor system
      dbExecutor - the dedicated executor service for DB writes (should be single-threaded)
  • Method Details

    • log

      public com.scivicslab.pojoactor.core.ActionResult log(String arg)
      Logs a message with level.

      Expected JSON format:

      
       {
         "sessionId": 1,
         "nodeId": "node-01",
         "level": "INFO",
         "message": "Processing started"
       }
       
      Parameters:
      arg - JSON string containing sessionId (long), nodeId (String), level (String matching LogLevel), and message (String)
      Returns:
      ActionResult with success=true and message "Logged", or success=false with the error message on failure
    • logAction

      public com.scivicslab.pojoactor.core.ActionResult logAction(String arg)
      Logs an action result with execution metadata.

      Expected JSON format:

      
       {
         "sessionId": 1,
         "nodeId": "node-01",
         "label": "deploy",
         "actionName": "runScript",
         "exitCode": 0,
         "durationMs": 1234,
         "output": "Script completed successfully"
       }
       
      Parameters:
      arg - JSON string containing sessionId (long), nodeId (String), label (String), actionName (String), exitCode (int), durationMs (long), and output (String)
      Returns:
      ActionResult with success=true and message "Action logged", or success=false with the error message on failure
    • startSession

      public com.scivicslab.pojoactor.core.ActionResult startSession(String arg)
      Starts a new workflow session.

      Expected JSON format:

      
       {
         "workflowName": "my-workflow",
         "overlayName": "production",
         "inventoryName": "hosts.yml",
         "nodeCount": 5
       }
       
      Parameters:
      arg - JSON string containing workflowName (String), nodeCount (int), and optional overlayName (String) and inventoryName (String)
      Returns:
      ActionResult with success=true and the session ID as the message, or success=false with the error message on failure
    • endSession

      public com.scivicslab.pojoactor.core.ActionResult endSession(String arg)
      Ends a workflow session with a terminal status.

      Expected JSON format:

      
       {
         "sessionId": 1,
         "status": "COMPLETED"
       }
       
      Parameters:
      arg - JSON string containing sessionId (long) and status (String matching SessionStatus)
      Returns:
      ActionResult with success=true and message "Session ended", or success=false with the error message on failure
    • markNodeSuccess

      public com.scivicslab.pojoactor.core.ActionResult markNodeSuccess(String arg)
      Marks a node as succeeded in the current session.

      Expected JSON format:

      
       {
         "sessionId": 1,
         "nodeId": "node-01"
       }
       
      Parameters:
      arg - JSON string containing sessionId (long) and nodeId (String)
      Returns:
      ActionResult with success=true and message "Node marked as success", or success=false with the error message on failure
    • markNodeFailed

      public com.scivicslab.pojoactor.core.ActionResult markNodeFailed(String arg)
      Marks a node as failed in the current session.

      Expected JSON format:

      
       {
         "sessionId": 1,
         "nodeId": "node-01",
         "reason": "Connection timeout"
       }
       
      Parameters:
      arg - JSON string containing sessionId (long), nodeId (String), and reason (String)
      Returns:
      ActionResult with success=true and message "Node marked as failed", or success=false with the error message on failure
    • getDbExecutor

      public ExecutorService getDbExecutor()
      Gets the dedicated executor service for DB writes.
      Returns:
      the DB executor service