# ADR-006: Transactional Outbox / Inbox for Events

| Field | Value |
| --- | --- |
| Status | Accepted |
| Date | 2025-01-01 |
| Deciders | Platform Architecture |
| Supersedes | — |
| Superseded by | — |

## Context

Services must publish domain events reliably without dual-write failures between DB commits and message brokers.

## Decision

Every service that emits events writes to `outbox_events` in the same business transaction. A worker processes pending outbox rows. Consumers record `inbox_events` by `event_id` for idempotency. Event envelope is `shared.events.EventEnvelope`.

## Consequences

### Positive

- Atomic business + event persistence
- Idempotent consumption
- Message-bus swap later without rewriting producers

### Negative

- Near-real-time, not hard real-time
- Requires Celery/worker ops

## Alternatives Considered

1. Direct broker publish in request path
2. Change-data-capture only

## Related Documents

- [Event-Driven Architecture](../event-driven-architecture.md)
- [Event Catalog](../../reference/event-catalog.md)
- [Services Contracts](../../reference/services-contracts.md)
