133

I'm getting confused between these two types of messages in RabbitMQ.

I've seen that some of my queues have 0 "Unacked" and 1000 "Ready" messages, while some have 1000 "Unacked" and 0 "Ready" messages.

What's the difference between them?

And how can I know how many of the messages are read by the consumer(s)?

sgonzalez
  • 1,086
  • 9
  • 24
Anil Kumar
  • 2,521
  • 7
  • 23
  • 40

2 Answers2

209

A message is Ready when it is waiting to be processed.

When a consumer connects to the queue it gets a batch of messages to process. The amount is given in the prefetch size. While this consumer is working on the messages they get the status unacked.

Unacked means that the consumer has promised to process them but has not acknowledged that they are processed. When the consumer crashed the queue knows which messages are to be delivered again when the consumer comes online. When you have multiple consumers the messages are distributed among them.

Oren Hizkiya
  • 4,420
  • 2
  • 23
  • 33
l.renkema
  • 2,470
  • 1
  • 15
  • 10
  • 11
    Worth to mention the Message is ready (waiting) even if there is not a single consumer. `Ready` messages are collected by the RabbitMQ. `Unacked` messages are "touched" by consumers but related jobs are not confirmed yet as done. – Sławomir Lenart Mar 30 '21 at 08:52
  • 6
    "When the consumer crashed the queue knows which messages are to be delivered again when the consumer comes online." Does that mean you need the same consumer to handle unacked messages? Or can it be a newly launched consumer, for example in case of a full crash. – Pat Feb 03 '22 at 09:07
22

enter image description here

Un-acknowledgment: It is used for Data Safety Considerations. it guaranteed to reach the peer and successfully processed. In case consumer lost in-between of processing of message and not acknowledge the Rabbit MQ. message will not lost and available for cosumer to process it again.

Rakesh Soni
  • 10,135
  • 5
  • 44
  • 51