AggregateName

Marks a field or property as containing the aggregate type name.

The aggregate name identifies the type or category of aggregate, distinguishing between different kinds of aggregates in the system (e.g., "order", "user", "product").

This annotation is used by the framework for:

  • Routing commands to the correct aggregate handlers

  • Generating event stream names

  • Providing context in logging and monitoring

  • Supporting multi-tenant aggregate isolation

The annotated field/property should contain a string that uniquely identifies the aggregate type within the bounded context.

Example usage:

@AggregateRoot
class OrderAggregate(
@AggregateId
val orderId: String,

@AggregateName
val aggregateName: String = "order"
) {

@OnCommand
fun create(command: CreateOrderCommand): OrderCreated {
// Order creation logic
}
}

See also

for marking aggregate instance identifiers

NamedAggregate

for interfaces that provide aggregate naming