outbox-demo · sequence diagram
Scenario A · Normal flow
The order and its event are saved together, the relay publishes once, and the consumer creates one payment.
Solid arrows: calls. Dashed: replies. Red: errors and crashes. Dashed blue boxes: database transactions; amber: the duplicate branch.
What to look for
OrderService never talks to Kafka: it only writes orders and outbox in one transaction.- The relay moves the event
NEW → PROCESSING → SENT. - The consumer records the
eventId and the payment in one transaction, and commits the offset last.