Replies: 1 comment 2 replies
-
Error notifications for channel operations (including publishing) is asynchronous in the protocol. See |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
When producing a message larger than the
max_message_size
configured on the server, the operation doesn't immediately raise an error, which I guess is expected.Instead, eventually we asynchronously get a "close channel" frame from the server, and set the
@last_channel_error
here:bunny/lib/bunny/channel.rb
Lines 1989 to 1999 in fba2bc8
The error looks like
PRECONDITION_FAILED - message size X is larger than configured max size Y
, and it will only be thrown the next time I try to produce from the channel as part of the message of theChannelAlreadyClosed
error.I would like to handle the
PreconditionFailed
when it arrives instead of relying on a future action to get theChannelAlreadyClosed
to deduce what happened, and reopen/replace it.To reproduce:
rabbitmq.conf
withmax_message_size = 10
AMQ::Protocol::Channel::Close
frame.cannot use a closed channel! Channel id: 2, closed due to a server-reported channel error: PRECONDITION_FAILED - message size 17 is larger than configured max size 10
I can check if
channel.closed?
before every publish and reopen or replace it as needed, but I won't be able to inspect the error if I do that as it's private, so maybe just producing regardless and catching theChannelAlreadyClosed
is better as a compromise. Or maybe adding the specific message to thechannel_level_exception_after_operation_that_has_no_response?
like on #682 is the correct approach.Or is there a way to get the configured
max_message_size
from the server to add validation on the message before producing, and avoid the issue altogether?I'm wondering what's the best approach to handle it, and I'd love for advice 🙂
Beta Was this translation helpful? Give feedback.
All reactions