Order creation writes to the database and then publishes order.created directly. During yesterday's broker outage, the database commit succeeded but publication failed. The order exists, yet inventory and email never heard about it.
Implement the transactional outbox pattern using the existing store and dispatcher:
- Creating an order must insert the order and its outbox record in one store transaction.
- Request handling must not publish directly to the broker.
- If either database write fails, neither record may remain, and the exception propagates out of
create to its caller.
- The dispatcher publishes pending records later and marks them sent.
Keep the order-service API unchanged.