Open uthunderbird opened 1 year ago
The thing is that the library does not take away the guarantee of publishing messages from the user. Only custom business logic dictates the behaviour at this point, should it catch the exception and wait for the .ready()
method and retry, or write to the log this broken state and skip the message or something else.
Robust
means this will restore state after reconnect, but not guarantee
the delivery in this case.
In my opinion, there is no more explicit behaviour for the user in the event of a connection failure than to say so explicitly and try to make recovery attempts in the background.
I am not sure if it is correct behavior.
I am using
aio-pika==8.2.0
but pretty sure it will do the same on latest versions.Here is my script to reproduce what I'm talking about. As you can see, here we use the same channel for publishing messages.
Now you should go to RabbitMQ management panel, and force close connection, and you will see something like
ERROR:aiormq.connection:Unexpected connection close from remote "amqp://admin:******@127.0.0.1:5672/", Connection.Close(reply_code=320, reply_text='CONNECTION_FORCED - Closed via management plugin')
in your log.And, soon after this moment, the script will be crashed with such exception:
aiormq.exceptions.ChannelInvalidStateError: <Channel: "1" at 0x7fafa2967240> closed
It looks like a correct behavior for
aiormq
because it's low-level enough, but not foraio-pika
.I think RobustChannel should be actually robust. If it should be fixed, I can try to fix it by myself and make some PR soon.