-
Notifications
You must be signed in to change notification settings - Fork 58
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
RabbitMQ connection does not throw exception while publishing a message when my RabbitMQ server is not running #128
Comments
You may want to glance at #119 as it is somewhat related. message.publish() without publisher confirms is "fire and forget" with no checks in it to know if the message was delivered or not. Ultimately if you need to be sure the message is delivered you will need enable_publisher_confirms() (which is a call to the server so the server needs to be online for this function to complete successfully) You may be able to connect the channel going down if the channel is used as contextmanager but that won't tell you for sure if a message was delivered or not. |
@cmlara Thanks, You mean I have to use And It does not throw an exception, it is stuck there,. I need to restart my flask application. |
Yes to 100% know a message was not delivered you would need to have My apologies that I misread when the deadlock would occur in your sample code. I did a quick test run from the command line (not in flask) with with the sample below (killing the rabbitserver during the sleep) and saw an exception raised both with and without publisher confirms enabled on the channel. I was not able to reproduce a deadlock. So at least it appears in non-complex situations the code is there to handle it. I'm not a rabbitpy or flask expert, so at this point the best I can suggest is if you haven't already some debug logging may help to be sure if rabbitpy is seeing the shutdown or not and to help make sure there isn't some other part of the code that is perhaps interfering.
|
@cmlara Thanks for your effort, If the load is low then deadlock would occur. I fired 1000 request concurrently and stuck in the deadlock |
I have created an app-level connection and an app-level channel, and I am using that connection&channel between multiple requests to publish a message.
My connection code:
My publisher code:
I can not use channel.enable_publisher_confirms() because it takes more time when the load is high
When I shut down my RabbitMQ server then If I publish a message then It should throw an exception but it is not throwing, So how can I know that my message is published or not?
And in above sitiation If I use channel.enable_publisher_confirms() , then at that point my program goes in to infinity loop(dead lock) in the function message.publish('test', 'test', mandatory=True)
I am using python 3.5(flask app), rabbitpy 2.0.1
The text was updated successfully, but these errors were encountered: