InMemoryDomainEventBus

class InMemoryDomainEventBus(val sinkSupplier: (NamedAggregate) -> Sinks.Many<DomainEventStream> = { Sinks.many().multicast().onBackpressureBuffer() }) : 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.

Parameters

sinkSupplier

The function to create sinks for named aggregates

See also

Constructors

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

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(namedAggregates: Set<NamedAggregate>): Flux<EventStreamExchange>

Receives messages for the specified named aggregates.

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 subscriberCount(namedAggregate: NamedAggregate): Int

Returns the number of subscribers for the specified named aggregate.