Transactional outbox and consumer deduplication
Shows atomic outbox creation, at-least-once delivery and idempotent consumption. Original worked design example; adapt responsibilities, thresholds and assumptions to your system.
Rendering…
What this template contains
- Diagram type
- Sequence diagram
- Source
- 23 lines
Make it your own.
sequenceDiagram
participant A as Order service
participant D as Database
participant R as Outbox relay
participant B as Event broker
participant C as Inventory consumer
A->>D: Begin transaction
A->>D: Save order and outbox event
A->>D: Commit both records
loop Until event acknowledged
R->>D: Read unpublished outbox records
R->>B: Publish stable event ID
B-->>R: Broker acknowledgement
R->>D: Mark published
end
B->>C: Deliver order event
C->>C: Check processed-event ID
alt New event
C->>C: Reserve stock and store event ID atomically
C-->>B: Acknowledge
else Redelivery
C-->>B: Acknowledge without second reservation
end