Domain API Reference
Domain configuration
| Attribute | Meaning |
|---|---|
__namespace__ | Required unique domain namespace |
__aggregate__ | Aggregate implementation |
__statemgr__ | State-manager class |
__logstore__ | Command/event log store |
__policymgr__ | Optional policy manager |
__msgdispatcher__ | Optional message dispatcher |
__evthandler__ | Optional event handler |
Every domain owns generated Command, Event, Response, and Message base classes. Subclassing those bases registers the entity with that domain.
Command metadata
Command.Meta supports keys including key, name, description, tags, resources, resource_init, auth_required, policy_required, roles_required, internal, allowed_zones, and flags controlling HTTP/MCP methods.
Commands validate their nested Data model and implement:
async def _process(self, aggregate, statemgr, payload):
yield aggregate.create_response({...})
Aggregate API
Decorate aggregate mutations with fluvius.domain.aggregate.action. Aggregates expose the active root, state manager, and helpers such as init_resource, create_response, create_event, and create_message.
Context and bundles
DomainContext is the serialized request context. CommandBundle contains the domain, command key, revision, resource, identifier, payload, optional scope identifiers, context ID, and status. Application code usually receives these through mounted transports rather than constructing sessions directly.