Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
RabbitMQ服务器已经关闭。但当我向RabbitMQ服务器发布消息时,python rabbitpy库不会抛出错误_Python_Python 3.x_Rabbitmq_Rabbitpy - Fatal编程技术网

RabbitMQ服务器已经关闭。但当我向RabbitMQ服务器发布消息时,python rabbitpy库不会抛出错误

RabbitMQ服务器已经关闭。但当我向RabbitMQ服务器发布消息时,python rabbitpy库不会抛出错误,python,python-3.x,rabbitmq,rabbitpy,Python,Python 3.x,Rabbitmq,Rabbitpy,我使用的是Python 3.5,rabbitpy 2.0.1。 我已经创建了一个flask应用程序,我还将eventlet库与我的应用程序一起使用 我已经创建了一个应用级连接和一个应用级通道,并且我正在多个请求之间使用该连接和通道使用rabbitpy库在RabbitMQ中发布消息 我的连接代码: app.conn = rabbitpy.Connection('amqp://guest:guest@127.0.0.1:5672/%2f') app.channel = app.conn.channe

我使用的是Python 3.5,rabbitpy 2.0.1。 我已经创建了一个flask应用程序,我还将eventlet库与我的应用程序一起使用

我已经创建了一个应用级连接和一个应用级通道,并且我正在多个请求之间使用该连接和通道使用rabbitpy库在RabbitMQ中发布消息

我的连接代码:

app.conn = rabbitpy.Connection('amqp://guest:guest@127.0.0.1:5672/%2f')
app.channel = app.conn.channel()
message = rabbitpy.Message(app.channel, json.dumps({"test": "test"}))
message.publish('test', 'test', mandatory=True)
我的出版商代码:

app.conn = rabbitpy.Connection('amqp://guest:guest@127.0.0.1:5672/%2f')
app.channel = app.conn.channel()
message = rabbitpy.Message(app.channel, json.dumps({"test": "test"}))
message.publish('test', 'test', mandatory=True)
当我关闭RabbitMQ服务器时,如果我发布了一条消息,那么它应该抛出一个异常(比如RabbitMQ服务器没有运行),但它没有抛出任何异常,所以我如何知道我的消息是否已发布


在上述情况下,如果我使用
channel.enable\u publisher\u confirms()
,那么此时我的程序在函数
消息中进入无限循环(死锁)。publish('test','test',mandatory=True)
,因此我无法使用它。

无法重现此问题。在我关闭rabbitmq后,发布服务器客户端将引发
RuntimeError:Timeout,等待打开套接字
@Spikie。您使用的是哪种操作系统?我正在使用Windows10。您是否按照以下步骤重现上述问题?1.创建连接&通道2。关闭RabbitMQ服务器3。发布消息。