到ActiveMQ的Python Stomp连接有错误的主题

2024-04-25 21:45:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试对ActiveMQ服务器形成Python+Stomp订阅。我正在本地主机上测试ActiveMQ服务器。这一切似乎都正常工作,除了主题XYZ的订阅名称被命名为ActiveMQ.Advisory.Consumer.Queue.XYZ,而我要连接到的队列(由java客户机创建)仅被命名为XYZ。你知道吗

有没有办法订阅这个“短”名字队列?你知道吗

import stomp

QUEUE_NAME='XYZ'

class MyListener(stomp.ConnectionListener):
    def on_error(self, headers, message):
        print('received an error "%s"' % message)
    def on_message(self, headers, message):
        print('received a message "%s"' % message)

headers = {}
conn = stomp.Connection( )
conn.set_listener('127.0.0.1:61616', MyListener())
conn.start()
conn.connect('admin', 'admin', wait=True)

conn.subscribe(destination=QUEUE_NAME, id=2, ack='auto')

time.sleep(6660)
conn.disconnect()

本地ActiveMQ控制台显示“主题”: Screenshot of ActiveMQ Topics panel

而真正的服务器有一个短的命名队列: Correct Name


Tags: name服务器message主题队列queueondef
1条回答
网友
1楼 · 发布于 2024-04-25 21:45:54

这看起来像是正常的代理行为,以支持“咨询消息”。它不应该对你的申请有任何直接影响。有关详细信息,请参见ActiveMQ documentation on this subject。你知道吗

相关问题 更多 >