LocalFirstCommandBus

class LocalFirstCommandBus(val distributedBus: DistributedCommandBus, val localBus: LocalCommandBus = InMemoryCommandBus()) : CommandBus, LocalFirstMessageBus<CommandMessage<*>, ServerCommandExchange<*>>

Command bus that prioritizes local processing before falling back to distributed processing. Void commands are automatically configured to skip local-first behavior since they don't require waiting for results.

Parameters

distributedBus

The distributed command bus for fallback processing.

localBus

The local command bus for primary processing. Defaults to InMemoryCommandBus.

Constructors

Link copied to clipboard
constructor(distributedBus: DistributedCommandBus, localBus: LocalCommandBus = InMemoryCommandBus())

Properties

Link copied to clipboard
Link copied to clipboard
open override val localBus: LocalCommandBus
Link copied to clipboard
open override val topicKind: TopicKind

The topic kind for command messages, always returns TopicKind.COMMAND

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 fun receive(namedAggregates: Set<NamedAggregate>): Flux<ServerCommandExchange<*>>

Receives messages for the specified named aggregates.

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

Sends a command message, prioritizing local processing. Void commands are automatically configured to not use local-first behavior.