InMemoryDomainEventBus

class InMemoryDomainEventBus(val sinkSupplier: (NamedAggregate) -> Sinks.Many<DomainEventStream> = { Sinks.unsafe().many().multicast().onBackpressureBuffer<DomainEventStream>().concurrent() }) : InMemoryMessageBus<DomainEventStream, EventStreamExchange> , LocalDomainEventBus

In-memory implementation of LocalDomainEventBus.

This class provides an in-memory message bus for domain events, suitable for testing or single-process applications. It uses reactive sinks to handle event publishing and subscription within the same JVM instance.

See also

Constructors

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

Creates a new InMemoryDomainEventBus with the specified sink supplier

Properties

Link copied to clipboard
open override val sinkSupplier: (NamedAggregate) -> Sinks.Many<DomainEventStream>

Function to create reactive sinks for each named aggregate (default: multicast sink with buffer)

Link copied to clipboard
open override val topicKind: TopicKind

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

Creates an EventStreamExchange from a DomainEventStream.

Link copied to clipboard

Wraps a LocalDomainEventBus with metrics collection capabilities. Returns a MetricLocalDomainEventBus that collects metrics on domain event operations.

Link copied to clipboard
open override fun receive(subscription: MessageSubscription): Flux<EventStreamExchange>

Receives messages for the specified named aggregates.

Link copied to clipboard

Creates a single message source with an explicit transport readiness boundary.

Link copied to clipboard

Creates the message source owned by a me.ahoo.wow.runtime.WowRuntime dispatcher.

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

Sends a message through the in-memory bus.

Link copied to clipboard
open override fun sendIfSubscribed(message: DomainEventStream): Mono<Boolean>

Attempts local delivery only while a processing subscriber is routable.

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

Returns the number of subscribers for the specified named aggregate.