-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing Connection Retry after Connection Loss #35
Comments
Update: I saw that the Django Channels consumer recovers from the error.
So it seems the problem is just with the own-written carehare connection... |
Good question. Indeed, I got as frustrated as you about this very problem. That's why I wrote carehare in the first place. The very-simplest logic is to ensure the whole app dies when the RabbitMQ connection fails. That way, in production, your service can spin up again and resume where it left off. At CJWorkbench, our background services do this. You're asking for a way to reconnect your RabbitMQ consumer's carehare connection without crashing your app. I can think of two solid approaches. Approach 1: a separate carehare connection for the consumer. Some pieces:
You can use your existing With this strategy, We use this on our production Django servers, in our queueing code. Job queues use a global-variable carehare connection, and Channels use Another idea -- untested -- is to piggy-back on
Here's the idea: Neither solution brings me joy. Django Channels is heavily influenced by its (flawed) Redis strategy. Its patterns are questionable. For us RabbitMQ users, the only value it provides is de-duplicating |
We decided to use the first approach.
I simply added the
Afterward, it worked with automatic retries 👍 |
PS: One question - is it fine to call the method with a new
In which case does |
D'oh, you indeed made the right fix.
As for the "stop" future: you can indeed pass a new Future ... or you can nix But Thank you for all your enthusiasm. I'm glad the restarts are working for you now. I'll close this issue after I copy/paste some of this code into the README. |
We have an HA RabbitMQ cluster, where we testing the HA functionality.
Our application structure is like following:
Consumer Implementation
Now, we face the problem, that if one RabbitMQ node in the cluster goes down, the application breaks:
Consumer Error
In the Django Channels consumer, we most possibly have the same problem:
Django Channels Consumer error
We like to reconnect automatically after a connection loss, how do you solve this problem?
The text was updated successfully, but these errors were encountered: