Recovery from ChannelWrongStateError #1433
-
I have a service that publishes messages to a RabbitMQ server and need to ensure a high level of resilience. In the event the RabbitMQ server needs to be restarted or there is a network issue, this client service needs to be able to automatically recover the connection. This seems like it should be simple, but attempting to implement some of the suggestions I have found have not yielded improvements. Here is a simple example script:
The
It sounds like this is caused by the RabbitMQ server for some reason thinking that the connection is permanently ruined and rejecting it; I cannot figure out how to create a fresh connection without restarting my client entirely. Thanks in advance for any assistance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Thanks for using Pika and RabbitMQ. Instead of copy-pasted code, please provide a git repository with code I can clone and run. As it is, your code will not run on its own and I don't have time to figure out how to make it work. I can probably guess but it's time taken away from reproducing and diagnosing your issue.
Please let me know how you are interrupting the connection. |
Beta Was this translation helpful? Give feedback.
I found a script in a Stack Overflow answer that is similar to the functionality in my script with a key difference being that it works. I made the following change to ensure it will attempt to reconnect until success:
There ar…