Charged Twice on Retry

A payments consumer reads charge events at-least-once and calls a card processor. After a deploy that killed pods mid-batch, a handful of customers were charged twice. Which change actually prevents this?

A

Raise the redelivery timeout well past the processor's slowest observed response so an in-progress charge is never handed to a second worker

B

Insert the event id into a dedup table with a unique constraint in the same transaction as the charge record, skip the event on conflict, and pass that id to the processor as its idempotency key

C

Turn on producer idempotence so the broker stamps each batch with a sequence number and rejects any duplicate the publisher retries after a timeout

D

Have the consumer acknowledge each message immediately after the processor returns, so the window between the charge and the acknowledgement is as small as possible