【问题标题】:aio-pika RPC pattern example crashes with: RobustConnection: connection closedaio-pika RPC 模式示例崩溃:RobustConnection:连接关闭
【发布时间】:2020-07-01 11:03:34
【问题描述】:

我正在尝试使用aio-pika 运行 RPC,使用它的 RPC Pattern。我在文档中运行了所有内容,只是更改了 AMPQ URL,但出现错误:

Task exception was never retrieved
quart_service_01_1  | future: <Task finished coro=<RobustConnection.reconnect() done, defined at /usr/local/lib/python3.6/site-packages/aio_pika/robust_connection.py:149> exception=RuntimeError('<RobustConnection: "amqp://dev_user:******@rabbit:5672/tgvhost" 1 channels> connection closed',)>
quart_service_01_1  | Traceback (most recent call last):
quart_service_01_1  |   File "/usr/local/lib/python3.6/asyncio/tasks.py", line 180, in _step
quart_service_01_1  |     result = coro.send(None)
quart_service_01_1  |   File "/usr/local/lib/python3.6/site-packages/aio_pika/robust_connection.py", line 150, in reconnect
quart_service_01_1  |     await self.connect()
quart_service_01_1  |   File "/usr/local/lib/python3.6/site-packages/aio_pika/robust_connection.py", line 105, in connect
quart_service_01_1  |     raise RuntimeError("{!r} connection closed".format(self))
quart_service_01_1  | RuntimeError: <RobustConnection: "amqp://dev_user:******@rabbit:5672/tgvhost" 1 channels> connection closed

在该跟踪之前,客户端似乎关闭了与兔子的连接:

2020-03-20 09:45:23.855 [info] <0.639.0> accepting AMQP connection <0.639.0> (172.30.0.5:40902 -> 172.30.0.3:5672)
rabbit_1            | 2020-03-20 09:45:23.870 [info] <0.639.0> connection <0.639.0> (172.30.0.5:40902 -> 172.30.0.3:5672): user 'dev_user' authenticated and granted access to vhost 'tgvhost'
rabbit_1            | 2020-03-20 09:45:23.917 [info] <0.639.0> closing AMQP connection <0.639.0> (172.30.0.5:40902 -> 172.30.0.3:5672, vhost: 'tgvhost', user: 'dev_user')

如果我尝试从Rabbit MQ aio-pika tutorial 执行 RPC,一切正常。我不确定这是一个错误还是我这边的一些错误配置,但我将这个兔子设置与 pika(不是 aio)和 nameko 框架一起使用并且没有任何问题。不,我想迁移到异步 quart 框架,所以我需要使用 aio-pika 进行 RPC。

码头工人 兔MQ 3.7.5 爱奥鼠兔 6.6.0 Python 3.6

【问题讨论】:

标签: python rabbitmq python-asyncio pika


【解决方案1】:

这似乎是 aio-pika 方面的问题,我通过将 aio-pika 降级到 6.3.0 解决了类似的问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-04
    • 2023-04-05
    • 2018-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多