persistentRepository

fun persistentRepository(runtimeRepository: AgentProcessRepository, snapshotStore: AgentProcessSnapshotStore, objectMapper: <Error class: unknown class>, agents: () -> Collection<Agent>, platformServices: () -> PlatformServices, checkpointPolicy: AgentProcessCheckpointPolicy = LifecycleCheckpointPolicy, blackboardEntrySerializers: List<BlackboardEntrySerializer> = emptyList(), clock: Clock = Clock.systemUTC()): AgentProcessRepository

Decorate runtimeRepository so that processes are checkpointed to snapshotStore and restored from it when runtime state has been lost.

The returned repository reads through: AgentProcessRepository.findById falls back to the snapshot store on a miss and warms the runtime repository with what it restores.

Parameters

runtimeRepository

fast, usually in-memory, repository holding live processes

snapshotStore

durable backend supplied by the application

objectMapper

mapper used for the snapshot payload and for blackboard values not claimed by a supplied serializer

agents

supplier of currently registered agents. Snapshots store the agent name, so restore binds a process to the live definition; this is a supplier because the platform is constructed after the repository

platformServices

supplier of platform services for restored processes, a supplier for the same reason

checkpointPolicy

when a process is written to the snapshot store. Defaults to LifecycleCheckpointPolicy, which checkpoints processes that are WAITING or finished

blackboardEntrySerializers

application serializers for blackboard values needing special handling, consulted in Spring @Order before the Jackson fallback

clock

clock used to stamp snapshots