0

I have a queue of messages, for a given message that is being popped off the rabbitmq queue, I want to what Nth message this is from the queue. It would be nice if there was a counter somewhere that was able to tell me what is the position number of this message in a given queue.

This is so that if multiple workers pull messages from the queue, they will get the position of each message. Worker 1 grabbed the 29th message, worker 2 grabbed 31th message, and worker 3 grabbed the 30th message etc.

user299709
  • 4,922
  • 10
  • 56
  • 88

1 Answers1

1

No, you cant get position of task in rabbitmq also. Multiple broker nodes, and workers may have already reserved the message but not yet started working on it due to prefetching.

RabbitMQ doesn't support any out-of-order operations on the queue, as it doesn't fit the message passing semantics and is hard to solve at scale.

But it is possible to preserve the order of messages if and only if messages published in one channel, passing through one exchange and one queue and one outgoing channel will be received in the same order that they were sent. RabbitMQ offers stronger guarantees since release 2.7.0.

Source: Quora, SO

Community
  • 1
  • 1
Chillar Anand
  • 27,936
  • 9
  • 119
  • 136