Alexandre Velo
Alexandre Velo

Reputation: 125

RabbitMq check if message exists in queue

I'm looking the best way for know if a RabbitMq message is processed or exists in queue. I have my Web Management that sends messages to my queue with a loot of traffic. My app checks in the database, during 1 minute if the consumer insert the new data on the database but if is not inserted the app shows a error, that the data is not inserted. The problem is in the case of high demand the delay can be a lot of time, and the data can be inserted after of the delay and the user of the Web Management don´t know if the data was inserted and the user can try to send another message to the queue. I need to know if is possible check if a message exists in the queue or know if the message was processed.

Upvotes: 4

Views: 8156

Answers (1)

TinoZ
TinoZ

Reputation: 570

Simplest answer.... no, you can't because it's against the architecture of an queue. It's build to post messages in and consume it constantly.

The only chance, if you are just working with 1 consumer is, interrupt it, consume ALL messages and repost them to the Queue and check if the desired message was consumed. Be aware, it will mess up the queue! I think a better solution will be another queue, where you consumer can publish a "finished" message on an own queue, which your original publisher can consume.

Upvotes: 3

Related Questions