CodePark/ questions / Delivery guarantees & idempotent consumers
START PRACTICINGPRACTICE
Backend question · Message queues & streaming › Delivery guarantees & idempotent consumers

Which consumer step order gives at-least-once delivery?

Process the message, then acknowledge it

"Process the message, then acknowledge it" gives at-least-once delivery. If the consumer crashes before the ack, the broker delivers the message again. So nothing is lost, but duplicates are possible.

"Acknowledge the message, then process it" and "Use auto-ack and process the message asynchronously" give
at-most-once delivery instead. The broker already thinks the message is handled. So if the consumer crashes during processing, the message is lost.