InMemoryStateEventBus

class InMemoryStateEventBus(val sinkSupplier: (NamedAggregate) -> Sinks.Many<StateEvent<*>> = { Sinks.many().multicast().onBackpressureBuffer() }) : InMemoryMessageBus<StateEvent<*>, StateEventExchange<*>> , LocalStateEventBus

In-memory implementation of LocalStateEventBus for testing and development. Uses Reactor Sinks for message broadcasting within the same JVM instance. Messages are not persisted and are lost when the application restarts.

Parameters

sinkSupplier

Supplier for creating sinks for each named aggregate (default: multicast sink with backpressure buffer).

Constructors

Link copied to clipboard
constructor(sinkSupplier: (NamedAggregate) -> Sinks.Many<StateEvent<*>> = { Sinks.many().multicast().onBackpressureBuffer() })

Properties

Link copied to clipboard
open override val sinkSupplier: (NamedAggregate) -> Sinks.Many<StateEvent<*>>
Link copied to clipboard
open override val topicKind: TopicKind

The topic kind for state events.

Functions

Link copied to clipboard
open override fun close()

Closes the message bus and releases any resources. Default implementation does nothing.

Link copied to clipboard
open override fun StateEvent<*>.createExchange(): StateEventExchange<*>

Creates a StateEventExchange from a StateEvent message. Wraps the state event in a SimpleStateEventExchange for processing.

Link copied to clipboard

Wraps a LocalStateEventBus with metrics collection capabilities. Returns a MetricLocalStateEventBus that collects metrics on state event operations.

Link copied to clipboard
open override fun receive(namedAggregates: Set<NamedAggregate>): Flux<StateEventExchange<*>>

Receives messages for the specified named aggregates.

Link copied to clipboard
open override fun send(message: StateEvent<*>): Mono<Void>

Sends a message through the in-memory bus.

Link copied to clipboard
open override fun subscriberCount(namedAggregate: NamedAggregate): Int

Returns the number of subscribers for the specified named aggregate.