Skip to content

Message Acknowledgment

Medium — good to knowBackend

ELI5 — The Vibe Check

Message acknowledgment is telling the queue 'I got this, you can delete it now.' Without acking, the queue keeps the message and might redeliver it. It's like signing for a package — until you sign, the delivery driver considers it undelivered.

Real Talk

Message acknowledgment (ack) is a protocol where consumers explicitly confirm successful processing of a message. Until acknowledged, the message remains in the queue and may be redelivered if the consumer dies or times out. Negative acknowledgment (nack) explicitly rejects a message for requeue or DLQ routing. Acknowledgment modes include auto-ack, manual ack, and batch ack.

Show Me The Code

channel.consume('orders', async (msg) => {
  try {
    await processOrder(JSON.parse(msg.content));
    channel.ack(msg);  // Success - remove from queue
  } catch (err) {
    channel.nack(msg, false, true);  // Fail - requeue
  }
});

When You'll Hear This

"Don't auto-ack messages — use manual acknowledgment so failed messages get requeued." / "The message sat unacknowledged for 30 minutes before the timeout triggered redelivery."

Made with passive-aggressive love by manoga.digital. Powered by Claude.