Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Know position of a Task in RabbitMQ

I was planning to use RabbitMQ for a project in which I require to know position of my task after every few second in the queue.

Say I am using it for generating reports and if there is a Queue then I would want to show the user his position in the queue before the task actually starts.

Is this something I can achieve through RabbitMQ??

like image 542
HackerNews Avatar asked Oct 27 '25 03:10

HackerNews


1 Answers

It is not possible to get message position in queue in RabbitMQ. In fact, it is something not related to AMQP protocol at all.

As a workaround to achieve what you want, you may add message id to some storage on publish, say MySQL database and then remove it from there when consumed. Then you can query that data to get metrics you want.

like image 88
pinepain Avatar answered Oct 29 '25 05:10

pinepain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!