Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ Ack Timeout

Tags:

rabbitmq


I'm using RPC Pattern for processing my objects with RabbitMQ.
You suspect,I have an object, and I want to have that process finishes and
After that send ack to RPC Client.
Ack as default has a timeout about 3 Minutes.
My process Take long time.
How can I change this timeout for ack of each objects or what I must be do for handling these like processess?

like image 761
parsa Avatar asked Nov 19 '18 11:11

parsa


2 Answers

Modern versions of RabbitMQ have a delivery acknowledgement timeout:

In modern RabbitMQ versions, a timeout is enforced on consumer delivery acknowledgement. This helps detect buggy (stuck) consumers that never acknowledge deliveries. Such consumers can affect node's on disk data compaction and potentially drive nodes out of disk space.

If a consumer does not ack its delivery for more than the timeout value (30 minutes by default), its channel will be closed with a PRECONDITION_FAILED channel exception. The error will be logged by the node that the consumer was connected to.

Error message will be:

Channel error on connection <####> : operation none caused a channel exception precondition_failed: consumer ack timed out on channel 1

Timeout by default is 30 minutes (1,800,000ms)note 1 and is configured by the consumer_timeout parameter in rabbitmq.conf.


note 1: Timeout was 15 minutes (900,000ms) before RabbitMQ 3.8.17.

like image 134
Ari0nhh Avatar answered Nov 01 '22 23:11

Ari0nhh


if you run rabbitmq in docker, you can describe volume with file rabbitmq.conf, then create this file inside volume and set consumer_timeout for example:

docker compose

version: "2.4"
services:
  rabbitmq:
    image: rabbitmq:3.9.13-management-alpine
    network_mode: host
    container_name: 'you name'
    ports:
        - 5672:5672
        - 15672:15672 ----- if you use gui for rabbit
    volumes:
        - /etc/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf

And you need create file

rabbitmq.conf

on you server by this way

/etc/rabbitmq/

documentation with params: https://github.com/rabbitmq/rabbitmq-server/blob/v3.8.x/deps/rabbit/docs/rabbitmq.conf.example

like image 1
MrOldSir Avatar answered Nov 01 '22 23:11

MrOldSir