AggregateSnapshotDispatcher

class AggregateSnapshotDispatcher(snapshotHandler: SnapshotHandler, val namedAggregate: NamedAggregate, val name: String = "-", val parallelism: Int = MessageParallelism.DEFAULT_PARALLELISM, val scheduler: Scheduler, val messageFlux: Flux<StateEventExchange<*>>) : AggregateMessageDispatcher<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

snapshotHandler

the handler responsible for creating and storing snapshots

namedAggregate

the named aggregate this dispatcher handles

name

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

parallelism

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

scheduler

the scheduler for processing messages

messageFlux

the flux of state event exchanges to process

Constructors

Link copied to clipboard
constructor(snapshotHandler: SnapshotHandler, namedAggregate: NamedAggregate, name: String = "-", parallelism: Int = MessageParallelism.DEFAULT_PARALLELISM, scheduler: Scheduler, messageFlux: Flux<StateEventExchange<*>>)

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

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 override fun close()

Closes the dispatcher by canceling the subscription.

Link copied to clipboard
open fun currentContext(): Context?
Link copied to clipboard
open fun dispose()
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
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 override fun run()

Starts the dispatcher by subscribing to the message flux.

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

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.