0

I am using Python 3.5, rabbitpy 2.0.1. I have created a flask app and I am also using the eventlet library with my app.

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 in RabbitMQ using the rabbitpy library.

My connection code:

app.conn = rabbitpy.Connection('amqp://guest:guest@127.0.0.1:5672/%2f')
app.channel = app.conn.channel()

My publisher code:

message = rabbitpy.Message(app.channel, json.dumps({"test": "test"}))
message.publish('test', 'test', mandatory=True)

When I shut down my RabbitMQ server then If I publish a message then it should throw an exception (Like RabbitMQ server is not running) but it is not throwing any exception, so how can I know that my message is published or not?

And in the above situation if I use channel.enable_publisher_confirms() , then at that point my program goes into an infinite loop (dead lock) in the function message.publish('test', 'test', mandatory=True), so I can not use it.

  • Can not reproduce this problem. After I shut down rabbitmq, the publisher client raise `RuntimeError: Timeout waiting for opening the socket` – spike 王建 Nov 02 '20 at 07:21
  • @Spikie Which operating system are you using? I am using windows 10. have you followed the following steps to reproduce the above problem? 1. Create a connection&channel 2. shut down the RabbitMQ server 3. Publish a message. – Nikunj Vadodariya Nov 02 '20 at 10:15

0 Answers0