DefaultCommandGateway

class DefaultCommandGateway(commandWaitEndpoint: CommandWaitEndpoint, commandBus: CommandBus, validator: Validator, requestIdChecker: RequestIdChecker, 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.

Parameters

commandWaitEndpoint

The endpoint for command waiting functionality.

commandBus

The underlying command bus for sending commands.

validator

The validator for command body validation.

requestIdChecker

Checker for command request ID idempotency.

waitCoordinator

Coordinator for managing wait handles.

commandWaitNotifier

Notifier for command wait signals.

Constructors

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

Properties

Link copied to clipboard
open override val enforcesCommandWaitTimeout: Boolean = true

Whether this gateway enforces WaitPlan.timeout itself.

Link copied to clipboard
open override val topicKind: TopicKind

The topic kind for command messages.

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(subscription: MessageSubscription): Flux<ServerCommandExchange<*>>

Receives messages for the specified subscription.

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: 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.