AggregateSnapshotDispatcher

class AggregateSnapshotDispatcher(val name: String = "-", val namedAggregate: NamedAggregate, val messageFlux: Flux<StateEventExchange<*>>, val parallelism: Int = MessageParallelism.DEFAULT_PARALLELISM, snapshotHandler: SnapshotHandler, val scheduler: Scheduler, messageReadiness: Mono<Void> = Mono.empty(), processingAdmission: () -> Unit = {}, processingQuiescence: () -> Unit = {}) : AggregateDispatcher<StateEventExchange<*>> , ProcessorInfo

Dispatcher for handling snapshot operations on state events for a specific aggregate. Routes state event exchanges to the snapshot handler for processing.

Parameters

name

the name of this dispatcher (default: aggregateName-AggregateSnapshotDispatcher)

namedAggregate

the named aggregate this dispatcher handles

messageFlux

the flux of state event exchanges to process

parallelism

the number of parallel processing groups (default: MessageParallelism.DEFAULT_PARALLELISM)

snapshotHandler

the handler responsible for creating and storing snapshots

scheduler

the scheduler for processing messages

messageReadiness

completion of asynchronous message-source setup when this dispatcher is registered directly with a runtime

processingAdmission

explicit transport-processing gate opened by start

processingQuiescence

logical transport gate closed by quiesce

Constructors

Link copied to clipboard
constructor(name: String = "-", namedAggregate: NamedAggregate, messageFlux: Flux<StateEventExchange<*>>, parallelism: Int = MessageParallelism.DEFAULT_PARALLELISM, snapshotHandler: SnapshotHandler, scheduler: Scheduler, messageReadiness: Mono<Void> = Mono.empty(), processingAdmission: () -> Unit = {}, processingQuiescence: () -> Unit = {})

Properties

Link copied to clipboard
open override val aggregateName: String
Link copied to clipboard
open override val contextName: String

The context name of the aggregate.

Link copied to clipboard
open override val isDisposed: Boolean
Link copied to clipboard
open override val messageFlux: Flux<StateEventExchange<*>>
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val namedAggregate: NamedAggregate
Link copied to clipboard
open override val parallelism: Int
Link copied to clipboard
open override val processorName: String

The processor name, set to SNAPSHOT_PROCESSOR_NAME.

Link copied to clipboard
open override val scheduler: Scheduler
Link copied to clipboard
open override val terminatedSignal: Mono<Void>

Functions

Link copied to clipboard
fun NamedAggregate.aggregateId(id: String = generateId(), tenantId: String = TenantId.DEFAULT_TENANT_ID): DefaultAggregateId

Creates an AggregateId for this NamedAggregate with the specified parameters.

Link copied to clipboard

Finds the aggregate type class associated with this named aggregate.

Link copied to clipboard

Converts this NamedAggregate to its corresponding AggregateMetadata.

Link copied to clipboard
fun cancel()
Link copied to clipboard
open fun currentContext(): Context?
Link copied to clipboard
open fun dispose()
Link copied to clipboard
override fun forceStop()

Releases resources promptly without blocking, and remains safe before prepare and across repeated or overlapping calls.

Link copied to clipboard

Generates a unique ID string for this NamedAggregate.

Link copied to clipboard
fun NamedBoundedContext.getContextAlias(boundedContext: BoundedContext? = MetadataSearcher.metadata.contexts[contextName]): String
Link copied to clipboard

Gets the context alias prefix for this bounded context.

Link copied to clipboard
open override fun handleExchange(exchange: StateEventExchange<*>): Mono<Void>

Handles a state event exchange by setting the snapshot function and delegating to the snapshot handler.

Link copied to clipboard

Checks if the named aggregate is available locally at runtime.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun onNext(value: Void?)
Link copied to clipboard
fun onSubscribe(s: Subscription?)
Link copied to clipboard
override fun prepare(runtimeContext: RuntimeContext): Mono<Void>

Prepares the dispatcher by subscribing without requesting messages.

Link copied to clipboard
override fun quiesce()

Stops admitting new work after the runtime has atomically closed global admission.

Link copied to clipboard
fun request(n: Long)
Link copied to clipboard
Link copied to clipboard

Finds the aggregate type class associated with this named aggregate, throwing an exception if not found.

Link copied to clipboard
open fun safeOnNext(value: Void)

Safely processes the next message.

Link copied to clipboard
open fun safeOnNextError(value: Void, throwable: Throwable)

Handles errors that occur during message processing.

Link copied to clipboard
override fun start()
Link copied to clipboard
override fun stopGracefully(): Mono<Void>

Performs a graceful shutdown of the dispatcher.

Link copied to clipboard

Extension function to convert a NamedAggregate to an EventNamedAggregate.

Link copied to clipboard
open override fun StateEventExchange<*>.toGroupKey(): Int

Computes the group key for parallel processing based on the message.

Link copied to clipboard

Converts this NamedAggregate to its string representation.

Link copied to clipboard

Converts this NamedAggregate to a string representation using the context alias.