A company extracts order processing into a microservice that must publish an event for every committed order. Separate database writes and event publication occasionally lose events after failures; which design closes this gap without a distributed transaction?
Show the answer
Correct answerC. Commit the order and an outbox record together, then relay events with idempotent consumers.
AWhy not this: A crash after commit but before publication can lose the event despite retries within the request.
BWhy not this: A reporting replica copies data but does not make order commits and event publication atomic.
CWhy this is right: An atomic outbox write preserves publication intent; idempotent consumers handle duplicate delivery.
DWhy not this: Publication before commit can announce an order whose database transaction subsequently fails.
A transactional outbox atomically records the order and the intent to publish, so a relay can retry delivery after failures. Publishing after commit with retries still leaves a failure window before publication or retry scheduling.