An SQS consumer applies account credits in DynamoDB, but a crash after committing a credit can cause the message to be delivered again hours later. Each event has a unique ID; which design prevents duplicate credits without losing unapplied credits?
Show the answer
Correct answerC. Transact a conditional event-ID insert with the balance update, then acknowledge after success
AWhy not this: FIFO deduplication suppresses duplicate sends within its deduplication interval, not repeated processing after a consumer crash.
BWhy not this: A crash after recording the ID could leave the credit unapplied while retries treat it as completed.
CWhy this is right: The conditional insert and balance update either both commit or neither commits, making retries safe.
DWhy not this: A crash after updating the balance could allow a retry to apply the credit again.
A DynamoDB transaction atomically records the event ID and applies the credit; the conditional insert prevents a replay from applying it again. Separate writes leave a crash window, and FIFO deduplication does not prevent consumer redelivery.