AggregateRoute
Configures the routes of an aggregate.
This annotation defines:
Resource naming for API endpoints
Whether routes are generated at all
Since 9.3.0 the aggregate's own policies are declared on the aggregate with Spaced and AggregateOwner; spaced and owner are deprecated but still read when the new annotation is absent.
The routing configuration affects how commands are dispatched and how API endpoints are generated for the aggregate.
Example usage:
@AggregateRoot
@AggregateRoute(resourceName = "orders")
@AggregateOwner(OwnerPolicy.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.
Deprecated since 9.3.0, use Spaced. Whether the aggregate's routes take a space from the request's Wow-Space-Id header (it adds no path segment). Only a spaced aggregate has a space written to its commands and its queries scoped by it. A command to any other aggregate carries the default space whatever its source (HTTP, a saga reacting to a spaced aggregate's event, in-process), and that aggregate neither checks nor records a command's space. Defaults to false.
Deprecated since 9.3.0, use AggregateOwner. Ownership policy determining tenant isolation. Controls whether operations require owner context and how ownership is determined.