小编Tuk*_*Tuk的帖子

Qpid Proton Python:长时间工作后不重新连接

我正在将 Qpid Proton Python 用于 AMQP 使用者,该使用者运行的作业可以持续 +1 分钟。

工作完成后,我得到了一个connection_closedwith Condition('amqp:resource-limit-exceeded', 'local-idle-timeout expired')

我了解发生这种情况是因为我的阻塞工作阻止了心跳。

令我困惑的是为什么我没有重新连接。调试质子,我得到了这行代码,其中self.connection.state的值为36,因此self.connection.state & Endpoint.LOCAL_ACTIVE返回 0。

  1. 这是为什么?我可以做些什么来启用重新连接吗?
  2. 首先,我可以在客户端做些什么来避免断开连接?

这是重现场景的工作代码:

from __future__ import print_function

from time import sleep

from proton.handlers import MessagingHandler
from proton.reactor import Container


class ExampleConsumer(MessagingHandler):
    def __init__(self, queue):
        super().__init__(2, False)
        self.queue = queue

    def on_start(self, event):
        self.container = event.container
        self.conn = event.container.connect(url='localhost:5672')
        self.receiver = event.container.create_receiver(self.conn, self.queue)
        print('listening for new messages on /' + self.queue)

    def …
Run Code Online (Sandbox Code Playgroud)

python activemq-classic amqp qpid

5
推荐指数
0
解决办法
449
查看次数

标签 统计

activemq-classic ×1

amqp ×1

python ×1

qpid ×1