Chuyển tới nội dung chính

Domain API Reference

Domain configuration​

AttributeMeaning
__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.