If I publish a message to an exchange and a consumer of the message fails to process it I can retry the message at a set interval. The problem is the message gets sent to all consumers instead of just the consumer which failed.
How do you only resend the message to the consumer which failed?
If consumer fails, then the message will stay in the queue and you dont have to send it again. When the consumer is up and running you will receive the last message that it failed to process. That way we solve the problem of sending the message over and over again. And you don't have to send a Nack just dont Ack the message and the message will be in the queue when the consumer fails. You can try that by getting the message and stopping the consumer before doing Ack. You will be able to see the message again in the queue.
suppose you have and exchange bound to more queues
exchange ---> queue1 ---> consumer 1
|---> queue2 ---> consumer 2
|---> queue3 ---> consumer 3
if one consumer fails, you don't need to re-send the message, the message is stored to the queue. That's the scope to have queues
Related
Bg:
Producer send a message to rabbitmq, its true rabbitmq will send a confirm msessage to producer. And rabbitmq will storage the message in exchange,queue. I have a question, when does the rabbitmq store the message, is before send confirm message or after that? I guess the workflow is broker storage the message first and then send confirm message, does it right?
Read https://www.rabbitmq.com/confirms.html#publisher-confirms. If you use publisher confirms, the broker will send an ack when the message has been stored.
I'm am using Virtual Destinations to implement Publish Subscribe model in ActiveMQ 5.15.13.
I've a virtual topic VirtualTopic and there are two queues bound to it. Each queue has it's own redelivery policy. Let's say Queue 1 will retry message 2 times in case there is an exception while processing the message and Queue 2 will retry message 3 times. Post retry message will be sent to deadletter queue.
I've observed that when a message is sent to VirtualTopic, it is delivered to both the queues.
I'm facing an issue where if the consumers of both queues are not able to process the message successfully. The message destined for Queue 1 is moved to deadletter queue after retrying for 2 times. My expectation is that message in Queue 2 would be deadlettered after 3 retries. But the message is retried to consumer of Queue 2 only for 2 times and then is stuck in Queue 2 as pending message.
There is no specific configuration I've done in activemq broker and the redelivery policy is applied programmatically. Is there any configuration I'm missing?
The problem was in my implementation as for queue2, a new factory instance was created and redelivery policy was not getting setup correctly. The default redelivery policy (max redeliveries=6, with some delay) kicked in which caused delay in redelivered message. I was testing the behaviour using junit test cases and the consumer died as soon as test case was finished but message was still pending for redeliveries.
Hi there i have a rabbitMQ queue and just one worker to handle queued messages. I want to know is there any way to tell rabbitMQ if a message is unacknowledged send it again to worker periodically.
Very thanks in advance.
RabbitMQ will consider a message delivered and not yet acknowledged as being consumed. You cannot enforce it to be re-delivered as long as the consumer which fetched it does not close the channel or reject the message via the basic.reject AMQP method.
You can read more about publish/delivery confirmation in the documentation.
I am new to celery and rabbitmq and I am trying to find out when I send a message from celery to rabbitmq why it is not showing up in the rabbitmq queue but the messages gets processed?
Here is a list of queue that have been created
The default message delivery mode is nack =true. That means when a producer sends a message to rabbitMQ server, it will buffer it in the message queue. But if there is any active consumer, then the message will be removed from the queue as soon as the message is sent. The other mode of delivery is manual acknowledging of the message. for that you should use nack=false. So the message is removed from the queue only when the consumer acknowledge the message.
I want to set the timeout period for the Acknowledge i.e. if the acknowledge is not received by the broker for the particular message from consumer within a time period then, the broker should resend the message to the consumer. Is it possible to set such settings in the broker???
Here are a couple links that explain how to solve this problem with ActiveMQ 5.9:
https://issues.apache.org/jira/browse/AMQ-3394
https://planet.jboss.org/post/coming_in_activemq_5_9_a_new_way_to_abort_slow_consumers
To summarize:
if the consumer JVM dies, the JMS connection between broker and consumer will timeout, and any unacknowledged message will be re-scheduled for delivery
if the JMS connection doesn't die but the consumer is stuck processing a message, AbortSlowAckConsumerStrategy will abort slow consumers when they reach the configured threshold of slowness, default is that a consumer that has not Ack'd a message for 30 seconds is slow
see http://activemq.2283324.n4.nabble.com/Acknowledgement-Timeout-td4531016.html
There is no support for this with the redelivery policy. jms is
connection oriented, so the assumption is that if the connection is
alive and there is no ack, the consumer has a good reason not to ack
yet.