Is there a timeout for signing RabbitMQ messages?

I would like to set a timeout after which an error message is automatically sent.

When I delete a message, I wait until it is transmitted through the socket, and the other side confirms its receipt.

Do I need to keep a list of timers, or can RMQ handle this automatically?

private void Run() { _rmqConnection = _queueConnectionFactory.CreateFactory().CreateConnection(); _rmqReadchannel = _rmqConnection.CreateModel(); _rmqReadchannel.QueueDeclare(QueueIdOutgoing(), true, false, false, null); _rmqReadchannel.BasicQos(0, 1, false); var consumer = new QueueingBasicConsumer(_rmqReadchannel); _rmqReadchannel.BasicConsume(QueueIdOutgoing(), false, consumer); while (true) { if (!_rmqReadchannel.IsOpen) { throw new Exception("Channel is closed"); } var ea = consumer.Queue.Dequeue(); string jsonData = Encoding.UTF8.GetString(ea.Body); if (OnOutgoingMessageReady != null) { OnOutgoingMessageReady(this, new QueueDataEventArgs(jsonData, ea.DeliveryTag)); } //waiting for ACK from a different thread } } 
+6
source share
1 answer

RabbitMQ does not provide any timeout mechanism for acknowledging messages. This is discussed in the official Python manual :

No message timeouts; RabbitMQ will only update a message when a connection to an employee dies. This is great, even if processing the message takes a very long time.

Section 3.1.8 of the AMQP specification 0-9-1 describes Acknowledgments, and it is very clear that they can be either automatic (the client does not have to do anything, messages are acknowledged as soon as they are delivered) or Explicit (the client must Ack for each message or group messages that he processed).

Here is a little past discussion back in 2009, confirming that this is so.

So: yes, if you need a timeout to automatically send NACK at some interval, you have to do it yourself.

+8
source

Source: https://habr.com/ru/post/988224/


All Articles