InMemoryMessageBus

Abstract base class for in-memory message bus implementations.

This class provides a local message bus that uses Reactor Sinks for message distribution within a single JVM instance. Messages are sent to subscribers via sinks and can be received by subscribing to the appropriate named aggregates.

Parameters

M

The type of message, must implement both Message and NamedAggregate

E

The type of message exchange

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val sinkSupplier: (NamedAggregate) -> Sinks.Many<M>

Supplier function that creates a sink for a given named aggregate.

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
abstract fun M.createExchange(): E

Creates a message exchange from this message.

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

Receives messages for the specified named aggregates.

Link copied to clipboard
open override fun send(message: M): 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.