Package-level declarations

Types

Link copied to clipboard

Client-side command exchange interface for commands sent from clients.

Link copied to clipboard

Command Bus interface for handling command messages in the CQRS architecture.

Link copied to clipboard

Base interface for command exchanges that facilitate message passing during command processing.

Link copied to clipboard

Command Gateway interface for sending commands and waiting for their results.

Link copied to clipboard

Provides utility functions and extensions for managing command operators in message headers. This object allows setting and retrieving operator information from command message headers, which is useful for tracking who initiated a command.

Link copied to clipboard
data class CommandResult(val id: String, val waitCommandId: String, val stage: CommandStage, val contextName: String, val aggregateName: String, val tenantId: String, val aggregateId: String, val aggregateVersion: Int? = null, val requestId: String, val commandId: String, val function: FunctionInfoData, val errorCode: String = ErrorCodes.SUCCEEDED, val errorMsg: String = ErrorCodes.SUCCEEDED_MESSAGE, val bindingErrors: List<BindingError> = emptyList(), val result: Map<String, Any> = emptyMap(), val signalTime: Long = System.currentTimeMillis()) : Identifier, WaitCommandIdCapable, CommandStageCapable, NamedBoundedContext, AggregateNameCapable, TenantId, NullableAggregateVersionCapable, CommandId, RequestId, ErrorInfo, FunctionInfoCapable<FunctionInfoData> , CommandResultCapable, SignalTimeCapable, Materialized

Represents the result of a command execution, containing all relevant information about the command processing outcome.

Link copied to clipboard

Interface for objects that can provide command execution results. Implementations of this interface expose their results as a map of key-value pairs, allowing for flexible result representation and access.

Link copied to clipboard
class CommandResultException(val commandResult: CommandResult, cause: Throwable? = null) : WowException, ErrorInfoCapable

Exception wrapping a command result that indicates failure.

Link copied to clipboard
class CommandValidationException(val command: Any, errorMsg: String = "Command validation failed.", bindingErrors: List<BindingError> = emptyList(), cause: Throwable? = null) : WowException, ErrorInfo

Exception thrown when command validation fails.

Link copied to clipboard
class DefaultCommandGateway(commandWaitEndpoint: CommandWaitEndpoint, commandBus: CommandBus, validator: Validator, idempotencyCheckerProvider: AggregateIdempotencyCheckerProvider, waitStrategyRegistrar: WaitStrategyRegistrar, 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.

Link copied to clipboard

Distributed Command Bus interface for handling commands across multiple instances or services.

Link copied to clipboard
class DuplicateRequestIdException(val aggregateId: AggregateId, val requestId: String, errorMsg: String = "Duplicate request ID[", cause: Throwable? = null) : WowException, NamedAggregate

Exception thrown when a duplicate request ID is detected.

Link copied to clipboard
class InMemoryCommandBus(val sinkSupplier: (NamedAggregate) -> Sinks.Many<CommandMessage<*>> = { Sinks.many().unicast().onBackpressureBuffer() }) : InMemoryMessageBus<CommandMessage<*>, ServerCommandExchange<*>> , LocalCommandBus

In-memory implementation of CommandBus for local command processing. This bus uses unicast sinks to ensure each command has exactly one consumer, making it suitable for single-instance or testing scenarios.

Link copied to clipboard

Local Command Bus interface for handling commands within the same JVM instance.

Link copied to clipboard
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.

Link copied to clipboard

Server-side command exchange interface for commands being processed by the server.

Link copied to clipboard
class SimpleClientCommandExchange<C : Any>(val message: CommandMessage<C>, val waitStrategy: WaitStrategy, val attributes: MutableMap<String, Any> = ConcurrentHashMap()) : ClientCommandExchange<C>

Simple implementation of ClientCommandExchange.

Link copied to clipboard
data class SimpleCommandMessage<C : Any>(val id: String = generateGlobalId(), val header: Header = DefaultHeader.empty(), val body: C, val aggregateId: AggregateId, val ownerId: String = OwnerId.DEFAULT_OWNER_ID, val requestId: String = id, val aggregateVersion: Int? = null, val name: String = body.javaClass.toName(), val isCreate: Boolean = false, val allowCreate: Boolean = false, val isVoid: Boolean = false, val createTime: Long = System.currentTimeMillis()) : CommandMessage<C> , NamedAggregate

Simple implementation of CommandMessage with default values for most properties. This class provides a convenient way to create command messages with sensible defaults.

Link copied to clipboard
class SimpleServerCommandExchange<C : Any>(val message: CommandMessage<C>, val attributes: MutableMap<String, Any> = ConcurrentHashMap()) : ServerCommandExchange<C>

Simple implementation of ServerCommandExchange.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun CommandMessage<*>.commandSentSignal(waitCommandId: String, error: Throwable? = null): WaitSignal
Link copied to clipboard

Converts a CommandBuilder to a CommandMessage.

fun <C : Any> C.toCommandMessage(id: String = generateGlobalId(), requestId: String? = null, aggregateId: String? = null, tenantId: String? = null, ownerId: String? = null, aggregateVersion: Int? = null, namedAggregate: NamedAggregate? = null, header: Header = DefaultHeader.empty(), createTime: Long = System.currentTimeMillis(), upstream: DomainEvent<*>? = null, ownerIdSameAsAggregateId: Boolean = false): CommandMessage<C>

Converts any object to a CommandMessage using reflection and metadata.

Link copied to clipboard

Converts a WaitSignal to a CommandResult.

fun Throwable.toResult(waitCommandId: String, commandMessage: CommandMessage<*>, function: FunctionInfoData = COMMAND_GATEWAY_FUNCTION, id: String = generateGlobalId(), stage: CommandStage = CommandStage.SENT, result: Map<String, Any> = emptyMap(), signalTime: Long = System.currentTimeMillis()): CommandResult

Converts a Throwable to a CommandResult representing a command failure.