CommandMessage
Represents a complete command message that encapsulates a command to be executed against an aggregate in the Wow framework.
This interface combines multiple concerns for command handling in a domain-driven design (DDD) context:
Aggregate targeting via AggregateIdCapable and NamedAggregate
Message structure via NamedMessage
Ownership context via OwnerId
Copy capability for immutability patterns
Command messages are the primary mechanism for initiating state changes in aggregates, supporting both creation and modification operations with proper versioning and idempotency guarantees.
Parameters
The type of the command payload, which contains the specific data for the operation
See also
for command uniqueness
for aggregate targeting
for message structure
Example usage:
data class CreateOrderCommand(
val customerId: String,
val items: List<OrderItem>
) : CommandMessage<CreateOrderCommand> {
// Implement required properties...
}Properties
The target aggregate identifier for this command.
The name of the aggregate.
The expected version of the target aggregate for optimistic concurrency control.
Indicates whether this command permits the creation of a new aggregate if one doesn't exist.
The name of the bounded context this entity belongs to.
The timestamp when this message was created, as a Unix timestamp in milliseconds.
Indicates whether this message is in read-only mode.
Functions
Creates and returns a copy of the current object.
Checks if two aggregates belong to the same context and have the same aggregate name.
Checks if this entity belongs to the same bounded context as another entity.
Adds all key-value pairs from the provided map to the message header and returns the message for method chaining.
Adds a key-value pair to the message header and returns the message for method chaining.
Marks this message as read-only and returns it for method chaining.