Pekko Runtime
PekkoRuntime leverages Pekko Persistence and Cluster Sharding to provide a distributed runtime for workflows.
"org.business4s" %% "workflows4s-pekko" % "0.4.0"
Example
Here is an example of using PekkoRuntime in a workflow:
import MyWorkflowCtx.*
given IORuntime                    = ???
given ActorSystem[?]               = ???
val engine: WorkflowInstanceEngine = ???
val workflow: WIO.Initial          = ???
val runtime: PekkoRuntime[Ctx] = PekkoRuntime.create("my-workflow", workflow, InitialState(), engine)
runtime.initializeShard()
val instance: WorkflowInstance[Future, State] = runtime.createInstance_("my-workflow-id")
Caveats
While PekkoRuntime offers robust distributed capabilities, it comes with some caveats:
- Configuration Complexity:
- A significant amount of complexity is encapsulated within Pekko.
- Proper configuration is essential to ensure smooth operation.
 
- Initial State Limitation:
- Unlike other runtimes, PekkoRuntimedoes not support arbitrary initial states during workflow instance creation. Initial state has to be build uniformly across all instances based onEntityContext.
 
- Unlike other runtimes, 
- Shard Initialization:
- The initializeShardmethod must be invoked before creating workflow instances to ensure proper setup.
 
- The