AggregateRoute
Configures routing and ownership behavior for aggregate operations.
This annotation defines how aggregate instances are accessed and managed in terms of:
Resource naming for API endpoints
Ownership policies for multi-tenant scenarios
Route generation for REST APIs
The routing configuration affects how commands are dispatched and how API endpoints are generated for the aggregate.
Example usage:
@AggregateRoot
@AggregateRoute(
resourceName = "orders",
owner = AggregateRoute.Owner.AGGREGATE_ID
)
class OrderAggregate(
@AggregateId
val orderId: String,
@OwnerId
val customerId: String
)This generates routes like: POST /orders/{orderId}/create
Parameters
Custom name for the resource in API routes. If empty, the aggregate class name (lowercased) will be used. This affects URL generation.
Whether routing is enabled for this aggregate. When false, no routes will be generated. Defaults to true.
Ownership policy determining tenant isolation. Controls whether operations require owner context and how ownership is determined.
See also
for available ownership policies
for marking aggregate root classes