A service commits an order to Amazon RDS and then publishes an event, but a crash between these operations can leave downstream services uninformed. Orders must commit without downstream availability, and duplicate events are acceptable; which design BEST meets these requirements?
Show the answer
Correct answerB. Commit an outbox record with the order, then relay events asynchronously.
AWhy not this: An external publish is not made atomic by placing its call inside a database transaction.
BWhy this is right: An atomic order-and-outbox commit preserves publication intent without requiring downstream availability.
CWhy not this: Publishing first can notify consumers about an order whose database transaction subsequently fails.
DWhy not this: In-memory retry state can disappear in the same crash that interrupts event publication.
A transactional outbox commits the order and pending event atomically, allowing a separate relay to publish later and retry after crashes. Publishing inside the database transaction still cannot make the database commit and external publish atomic, and it adds an availability dependency.