[rabbitmq-discuss] Same consumer getting the rejected message again
Emile Joubert
emile at rabbitmq.com
Tue Apr 2 10:37:56 BST 2013
Hi,
On 29/03/13 07:44, reddylast wrote:
> I've set-up multiple queues and multiple consumers are processing those
> queues. There is a case when a consumer receives a message , if that
> consumer is not authorized to process that message then system sent it back
> to the queue (by using basic.reject method). I want to stop the same
> consumer getting the same rejected message again and again. Is there any
> way that prevents a message from looping through the system forever ?
If you requeue a message then it will return to the queue in the same
position that it was, and that may lead to the same consumer getting the
message if it goes to the front of the queue.
You could re-publish the message instead of requeueing, which will force
it to the back of the queue and hope that a different consumer gets the
message when it reaches the front. You could also publish such messages
to a different location where you guarantee that authorisation will not
fail.
In general you should try to route messages to separate queues and bind
consumers in such a way that they will only receive messages which they
are able to process.
-Emile
More information about the rabbitmq-discuss
mailing list