DefaultCommandGateway

class DefaultCommandGateway(commandWaitEndpoint: CommandWaitEndpoint, commandBus: CommandBus, validator: Validator, idempotencyCheckerProvider: AggregateIdempotencyCheckerProvider, waitCoordinator: WaitCoordinator, commandWaitNotifier: CommandWaitNotifier) : CommandGateway, CommandBus

Default implementation of the CommandGateway interface. This gateway provides comprehensive command handling including validation, idempotency checking, and various sending strategies with optional waiting.

Constructors

Link copied to clipboard
constructor(commandWaitEndpoint: CommandWaitEndpoint, commandBus: CommandBus, validator: Validator, idempotencyCheckerProvider: AggregateIdempotencyCheckerProvider, waitCoordinator: WaitCoordinator, commandWaitNotifier: CommandWaitNotifier)

Properties

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 override 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 through the command bus after performing validation and idempotency checks. Notifies wait plans if configured in the message header.

Link copied to clipboard
open override fun <C : Any> sendAndWait(command: CommandMessage<C>, waitPlan: WaitPlan): Mono<CommandResult>

Sends a command and waits for the final result. Throws CommandResultException if the command execution fails.

Link copied to clipboard

Sends a command and waits until it is fully processed by the aggregate.

Link copied to clipboard
open override fun <C : Any> sendAndWaitForSent(command: CommandMessage<C>): Mono<CommandResult>

Sends a command and completes with the SENT stage result as soon as the command bus accepts it.

Link copied to clipboard
open fun <C : Any> sendAndWaitForSnapshot(command: CommandMessage<C>): Mono<CommandResult>

Sends a command and waits until the aggregate state is snapshotted.

Link copied to clipboard
open override fun <C : Any> sendAndWaitStream(command: CommandMessage<C>, waitPlan: WaitPlan): Flux<CommandResult>

Sends a command and returns a stream of command results as they become available. This method allows monitoring the progress of command execution in real-time.