Replies: 2 comments
-
Consumers do not manage channels. If RabbitMQ closes the channel, Bunny cannot do anything about it (it also works the other way around). Asynchronous error notifications is the only option available to client libraries: Java and .NET clients expose "shutdown handlers" on their Bunny allows you to pass in a block for error handling. A similar method can be added to the consumer interface but since most consumers are Using exceptions can lead to very difficult to reason about behaviors. In fact, your idea of updating Please submit a PR. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the additional information. I opened a PR with the above changes. PR: #684 |
Beta Was this translation helpful? Give feedback.
-
Consumer silently losing its channel due to RabbitMQ closing the channel because of a delivery acknowledgement timeout.
I have a channel open with a consumer working it. Messages are being being pulled off and the consumer is manually acknowledging them. I ran into the issue of a delivery acknowledgement timeout (https://www.rabbitmq.com/docs/consumers#acknowledgement-timeout) that resulted in rabbit closing the consumers channel with a
PRECONDITION_FAILED
channel exception. This manifested in the application silently accumulating messages with no indication that the consumer was no longer being delivered messages on the channel. When I recreate the delivery ack timeout (create q with a short timeout and simulate a job that hangs the work pool thread and never acks), I see theAMQ::Protocol::Channel::Close
frame (bunny/lib/bunny/channel.rb
Line 1802 in 8b700a0
@on_error
handler. Unfortunately, in this case, the on_error handler is never called (bunny/lib/bunny/channel.rb
Lines 1807 to 1812 in 8b700a0
last_channel_error
ends up pushed onto the continuations. If the thread working the message is hung, this error is never raised. I'm trying to understand if there is a way my channel can be notified that RabbitMQ is closing it due to the delivery acknowledgement timeout (reply code 406)? (besides monkey patching a condition intochannel_level_exception_after_operation_that_has_no_response?
bunny/lib/bunny/channel.rb
Lines 1822 to 1824 in 8b700a0
but I'm trying to fully understand what the best approach here would be. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions