0003: Publish events through a transactional outbox
Status: Accepted ยท Date: 2026-09-29
Contextโ
Events like TaxDocumentCommitted drive the GL. An event for a change that rolled back, or a lost event for a change
that committed, would put the books out of step.
Decisionโ
MassTransit's Entity Framework outbox. Events are written to Postgres in the same transaction as the change and delivered after it commits. The inbox de-duplicates redelivered messages.
Consequencesโ
- RabbitMQ downtime never fails a REST call.
- Delivery is at-least-once, so consumers must be idempotent (ours are, by source document id).
- The outbox tables live in the
integrationsschema and are created by the migrations.