Qpid Proton Python:长时间作业后不重新连接
我正在为AMQP消费者使用Qpid Proton Python,该消费者运行的作业可以持续+1分钟 作业完成后,我将获得一个Qpid Proton Python:长时间作业后不重新连接,python,activemq,amqp,qpid,Python,Activemq,Amqp,Qpid,我正在为AMQP消费者使用Qpid Proton Python,该消费者运行的作业可以持续+1分钟 作业完成后,我将获得一个连接\u关闭条件('amqp:resource limited extended','local idle timeout expired') 我理解这种情况的发生,因为我的阻塞工作是阻止心跳 让我困惑的是为什么我没有重新连接。调试proton,我到达,其中self.connection.state的值为36,因此self.connection.state和Endpoint
连接\u关闭条件('amqp:resource limited extended','local idle timeout expired')
我理解这种情况的发生,因为我的阻塞工作是阻止心跳
让我困惑的是为什么我没有重新连接。调试proton,我到达,其中self.connection.state
的值为36,因此self.connection.state和Endpoint.LOCAL\u ACTIVE
返回0
为什么呢?我可以做些什么来启用重新连接吗
首先,我可以在客户端做些什么来避免断开连接
下面是重现该场景的工作代码:
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 on_message(self, event):
print('sleeping 60')
sleep(60)
print('done sleeping')
self.accept(event.delivery)
def on_connection_error(self, event):
print('connection_error', event.connection.condition, event.connection.remote_condition)
try:
Container(ExampleConsumer('examples')).run()
except KeyboardInterrupt: pass
有没有可能看到一个关于这个的图片?@Triarion有一个MRE。它需要一个位于localhost:5672
的工作AMQP代理和一条关于examples
队列的消息。您可以使用qpid源代码中的示例来实现这一点。下面是一个带有完整MRE的repo,可以复制:@Tuk您解决了这个问题吗?