Hi,
i am having trouble on how to update the rabbitMq config to change the default consumer timeout which is 1800000, my consumer takes a little bit longer in some scenarios. Because of the default 30 mins timeout the message is being repushed to the queue, as we are having multiple consumers if the first consumer has not finished the processing of the message and the same message has been repushed to the queue which was picked up by another consumer listening to the queue. So due to this issue our server resources were being utilized to maximum making other requests to slow down, so we want to update our rabbitMq configuration to increase the timeout to atleat 6-7 hours.
So our rabbit Mq server is running on the different linux server other than the server in which our consumers were hosted, we have tried updating the policies related to consumer-timeout even if it got updated our consumers were still having the default timeout(1800000), we have tryed deleting the queues & also tried restarting all the consumers still there is no changes in the timeout configuration of the consumers.

Any help with this issue is appreciated.
Thankyou.
Loading

Jayraj ChhayaRank #304 · 8.2K reputationPosted Nov 25, 2024, 4:52 AM EST
To update the RabbitMQ consumer timeout configuration, you can set a policy that overrides the default timeout. Since you mentioned that the changes did not take effect, ensure that you are applying the policy correctly. Here’s how you can do it:
Define a Policy: Use the RabbitMQ Management Plugin or the command line to create a policy that sets the
consumer_timeoutto your desired value. For example, to set it to 6 hours (21600000 milliseconds):rabbitmqctl set_policy my_policy "^your_queue_name$" '{"consumer_timeout":21600000}' --apply-to queuesRestart Consumers: Ensure that all consumers are restarted after applying the policy to pick up the new configuration.
Check for Conflicts: If the timeout still defaults to 30 minutes, verify that there are no other policies or configurations that might be overriding your settings.
By following these steps, you should be able to extend the consumer timeout effectively, thus preventing unnecessary message repushing and optimizing resource utilization.
Pavan Kumar27 reputationPosted Nov 26, 2024, 2:40 AM EST
Hi Jayraj Chhaya,
We have added the policy like below, is the syntax that we were following has any issue ?
rabbitmqctl set_policy queue_consumer_timeout "with_delivery_timeout\.*" '{"consumer-timeout":86400000}' --apply-to classic_queuesWe also tryed listing the policies with "rabbitmqctl list_policies" this command then also we see the policy that we have set and nothing else was there to conflict with it...
After applying the policies we have restarted the consumers and also tryed deleting the queues as they will be auto created when consumer runs, hopping the consumer timout resets but it didn't worked !!
Thank You