SL Saga Lab
live Go NATS JetStream SQLite / service

Distributed systems demo

An order saga with an orchestrator and a transactional outbox.

Four Go processes, four SQLite databases and an embedded NATS JetStream broker. Every command is committed with its outbox row in one transaction, then relayed to the broker. Failures trigger compensating transactions — and every step streams into the log panel below.

saga orchestration transactional outbox idempotent consumers durable JetStream consumers SSE observability

Happy path

3 commands · 3 events
  1. 1 Reserve inventory cmd
  2. 2 Charge payment cmd
  3. 3 Create shipment cmd
  4. ↩ On failure: refund, then release stock compensate

Total orders

0

saga instances

Completed

0

all steps succeeded

In flight

0

running or compensating

Compensated

0

rolled back cleanly

Failed

0

rejected at reservation

Place a single order

Choose a scenario to exercise the happy path or a compensation.

Load test

POST /api/loadtest

The endpoint returns immediately. Orders are created by a bounded worker pool and processed asynchronously through the saga.

Orchestrator

—

loading…

state machine · outbox relay · SSE hub

Inventory

—

loading…

reserve / release stock

Payment

—

loading…

charge / refund

Shipping

—

loading…

create / cancel shipment

Recent sagas

Each row is one order moving through the state machine.

—
OrderStatusCurrent stepAmountStepsAge
No orders yet. Place one above.

Live logs

SSE
info warn error
0 lines

Saga orchestration

The orchestrator owns the state machine and decides the next command. Participants never call each other, so the compensation path is explicit.

Transactional outbox

Business state and the outbox row share one SQLite transaction. The relay only marks a row published after JetStream confirms persistence.

Idempotent consumers

Deterministic command IDs and processed-command tables turn at-least-once delivery into effectively-once business behaviour.

Bounded load

The load-test button is a real HTTP endpoint. It returns in milliseconds while a bounded worker pool drives the sagas asynchronously.

—

—