getOrInitialize

abstract fun getOrInitialize(namedAggregate: NamedAggregate): Scheduler

Gets an existing scheduler for the named aggregate or creates a new one if none exists.

This method should return a scheduler that is appropriate for handling operations related to the specified aggregate. Implementations may choose to cache schedulers to improve performance and resource utilization.

Example usage:

val supplier = DefaultAggregateSchedulerSupplier("my-app")
val scheduler = supplier.getOrInitialize(namedAggregate)

Mono.just("data")
.publishOn(scheduler)
.map { process(it) }
.subscribe()

Return

a scheduler dedicated to operations for this aggregate

Parameters

namedAggregate

the aggregate for which to get or create a scheduler

See also