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

Request lifecycle

This page traces a command and a query through a coupled service. Each step names the component that owns it, so you know where to look when something misbehaves.

A command​

StepOwnerFails with
Body size limitriverbase_httpWEB-103
Authenticationriverbase_http::authAUT-001, AUT-002
Activity authorizationriverbase_http::casbinAUT-003, CAS-011
Payload decoding and validationThe generated command routeWEB-001 (422)
Command lookupThe command registryCMD-*
Loading the root (object commands)AggregateCore::openDAT-001 (404) when missing or in another tenant
Business rulesYour aggregateYour domain codes (TDO-*)
CommitCommandUnitOfWorkDAT-* (conflicts are 409)

Everything from "begin" to "commit" is one database transaction. If any step fails, the state change, the audit records, and the outbox rows roll back together. The command log is then updated to an error status.

A query​

A query never opens a write transaction and never touches the aggregate. If the policy cannot be resolved for a policy: required resource, the engine denies the request instead of returning everything.

Where to hook in​

You need toHook
Reject a request before any domain code runsCasbin policy, or a custom axum layer
Enforce a rule on every command, including non-HTTP callsA CommandPolicy on the engine
Restrict rowsscope_policy on the resource; tenant access policy in config
React after a successful commandConsume its integration message from the bus
Run code after execute in the same requestdomain_trait: manual and a custom DomainCommandEngine::execute