Skip to content

Essential

Port: REST :3050 · gRPC :5050

Manages distributed saga transactions across multiple services. Sagas coordinate multi-step operations (e.g. a business creation that touches logistic/locations, financial/accounts, and context/configs atomically). Saga records and their per-step stages are stored in MongoDB; if a saga's TTL expires before it is committed, the watcher worker triggers compensation for crash recovery.

Collections

CollectionPathPurpose
Sagas/essential/sagasTop-level orchestration record
Saga Stages/essential/saga-stagesPer-step execution history

essential/sagas

Tracks the top-level orchestration unit for a long-running or distributed operation.

Use the platform REST start endpoint — not the raw CRUD create:

POST /essential/sagas/start
{ "ttl": 3600 }

The Platform manages job, state, and session automatically. This is the correct path for user-facing saga orchestration.

Raw Create Fields (Advanced / Admin Use)

FieldRequiredTypeDescription
ttlnumberSaga lifetime in seconds
jobUUIDSaga job identifier — must be provided explicitly
stateSagaStateAWAITING, ABORTED, COMMITTED
sessionhex stringAssociated session identity

Special Operations (Platform REST only — no MCP equivalent)

OperationHTTPPurpose
startPOST /essential/sagas/startInitiate a saga (preferred)
addPOST /essential/sagas/addAppend a stage to an in-flight saga
abortGET /essential/sagas/:id/abortAbort an in-flight saga
commitGET /essential/sagas/:id/commitCommit a completed saga

essential/saga-stages

Records one step within a saga, including what was attempted and what came back.

essential/saga-stages has no MCP tools. Stage data can only be read or written via platform REST.

Required Create Fields

FieldRequiredTypeDescription
sagaMongoIdParent saga ID
bucketCollection enumTarget collection for this stage
actionSagaStageActionCOUNT_DOCUMENTS, INSERT_MANY, FIND_ONE, FIND, FIND_ONE_AND_UPDATE, FIND_ONE_AND_DELETE, UPDATE_MANY
reqobjectCaptured request payload

Population

essential/saga-stages supports sagaEssentialSaga plus common population.

Key Behaviors

  • Sagas are typically backend-driven. Client code starts them using start, then the Platform's watcher worker handles timeout compensation automatically.
  • If a saga's TTL expires before it is committed, the watcher worker triggers compensation (rollback) of all recorded stages.
  • The primary cross-service consumer is financial/transactions — every transaction is saga-linked.