Nikita Makovei

Case VI · Saga orchestration

The Long Caravan

Five services must each do their part, in order. There is no single transaction to hold them together, only a record of how far they got.

Where
Quiby, open source
When
2025
Pattern
Saga orchestration

I · Departure

A pipeline with no single owner

Quiby is my open-source Go project: a rebuild of the ClientPulse platform as event-driven microservices on Kafka. Reviews are ingested, preprocessed, turned into vectors and indexed for search, and the user is told when it is done. Each step is a separate service.

II · Initiation

The one who remembers the way

A database transaction is all or nothing. Across services there is no such thing. A saga replaces it with two rules: every step has an action that undoes it, and someone remembers how far the work has gone.

In Quiby that someone is a saga orchestrator. It keeps the state of each saga in PostgreSQL and handles messages idempotently. So when the orchestrator itself dies, it reads the state and continues from the same step.

Sandbox · Saga orchestration

A model, not production data

Press the steps from 1 to 4. In step 3, watch what happens after the orchestrator comes back.

III · Return

What it cost

The orchestrator knows every step, so every new step changes it. And for a moment, between a failure and its last undo, the system shows work that will disappear. A saga is not isolation. It is an honest plan for cleaning up.

Patterns in this case

What to call these things

Saga Microservices
A long piece of work across services, made of local steps. There is no shared transaction; there is a plan for failure. In the sandbox: the five boxes.
Orchestration, not choreography Microservices
One service directs the others and knows the whole plan. The other way is for services to react to each other's events, with no one in charge. In the sandbox: the box at the top and its lines.
Compensating transaction Microservices
Each step has an action that undoes it. It is new work, not a rollback, and it must be safe to repeat. In the sandbox: the dashed boxes in step 2.
Process Manager and State Machine Integration
The orchestrator keeps the state of each saga and decides the next message from that state. In the sandbox: the list written to PostgreSQL.
Idempotent Consumer Messaging
After a restart some messages come again. Each service must handle them once. In the sandbox: step 3: steps 1 and 2 are not repeated.