SimpleCommandAggregate

class SimpleCommandAggregate<C : Any, S : Any>(val state: StateAggregate<S>, val commandRoot: C, eventStore: EventStore, metadata: CommandAggregateMetadata<C>) : CommandAggregate<C, S> , NamedTypedAggregate<C>

Simple implementation of CommandAggregate that handles command processing with state management.

This class coordinates between command execution, state aggregation, and event storage. It manages the command processing lifecycle including validation, execution, event sourcing, and persistence.

Parameters

C

The type of the command aggregate root.

S

The type of the state aggregate.

eventStore

The event store for persisting domain events.

metadata

The metadata describing this command aggregate's configuration.

Constructors

Link copied to clipboard
constructor(state: StateAggregate<S>, commandRoot: C, eventStore: EventStore, metadata: CommandAggregateMetadata<C>)

Properties

Link copied to clipboard
open override val aggregateId: AggregateId
Link copied to clipboard
open override val aggregateName: String
Link copied to clipboard
open override val aggregateType: Class<C>
Link copied to clipboard
open override val commandRoot: C

The command aggregate root instance.

Link copied to clipboard

The current state of command processing.

Link copied to clipboard
open override val contextName: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val processorName: String
Link copied to clipboard
open override val state: StateAggregate<S>

The associated state aggregate containing the current state.

Link copied to clipboard
open override val version: Int

Functions

Link copied to clipboard
fun NamedAggregate.aggregateId(id: String = generateId(), tenantId: String = TenantId.DEFAULT_TENANT_ID): DefaultAggregateId

Creates an AggregateId for this NamedAggregate with the specified parameters.

Link copied to clipboard

Finds the aggregate type class associated with this named aggregate.

Link copied to clipboard

Converts this NamedAggregate to its corresponding AggregateMetadata.

Link copied to clipboard

Generates a unique ID string for this NamedAggregate.

Link copied to clipboard
fun NamedBoundedContext.getContextAlias(boundedContext: BoundedContext? = MetadataSearcher.metadata.contexts[contextName]): String
Link copied to clipboard

Gets the context alias prefix for this bounded context.

Link copied to clipboard

Checks if the named aggregate is available locally at runtime.

Link copied to clipboard
open override fun isSameAggregateName(other: NamedAggregate): Boolean
Link copied to clipboard
Link copied to clipboard
open override fun process(exchange: ServerCommandExchange<*>): Mono<DomainEventStream>

Processes a command exchange by validating, executing, and persisting the results.

Link copied to clipboard

Finds the aggregate type class associated with this named aggregate, throwing an exception if not found.

Link copied to clipboard

Extension function to convert a NamedAggregate to an EventNamedAggregate.

Link copied to clipboard
fun AggregateIdCapable.toGroupKey(parallelism: Int = DEFAULT_PARALLELISM): Int

Computes a grouping key for parallel processing based on the aggregate ID.

Link copied to clipboard

Converts this NamedAggregate to its string representation.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Converts this NamedAggregate to a string representation using the context alias.