gpt4 book ai didi

python - 无法使用 STOMP 将消息发送到 activemq

转载 作者:行者123 更新时间:2023-12-02 20:00:14 27 4
gpt4 key购买 nike

我正在尝试使用 STOMP 协议(protocol)向我的 activemq 发送消息,但出现以下错误:

(limetray) Vaibhavs-MacBook-Air:Desktop vaibhav$ python receiver_topic.py heyhey
Unknown response frame type: ';activemq' (frame length was 11)
Unknown response frame type: '
' (frame length was 2)
Unknown response frame type: ')' (frame length was 2)
Unknown response frame type: '
' (frame length was 1)
Unknown response frame type: 'tcpnodelayenabled' (frame length was 20)
Unknown response frame type: 'sizeprefixdisabled' (frame length was 20)
Unknown response frame type: ' cachesize' (frame length was 11)
Unknown response frame type: '' (frame length was 1)
Unknown response frame type: '

我正在使用下面的 python 脚本发送消息:

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)
hosts = [('localhost', 61616)]

conn = stomp.Connection(host_and_ports=hosts)
conn.set_listener('', MyListener())
conn.start()
conn.connect('admin', 'admin', wait=True,headers = {'client-id': 'clientname'} )
conn.subscribe(destination='A.B.C.D', id=1, ack='auto',headers = {'subscription-type': 'MULTICAST','durable-subscription-name':'someValue'})
#conn.subscribe({destination=config['/topic/test'], ack:'auto', 'activemq.subscriptionName':'SampleSubscription'})
#conn.subscribe(destination='/topic/testTopic', ack='auto', headers = {'activemq.subscriptionName': 'myhostname'})

conn.send(body=' '.join(sys.argv[1:]), destination='A.B.C.D')

time.sleep(2)
conn.disconnect()

用于调用脚本的命令:

python receiver_topic.py heyhey

我认为需要在 activemq.xml 文件中添加一些内容。对此的任何建议都会非常有帮助。

最佳答案

从所提供的内容来看,您似乎正在连接到默认为“61616”的代理上的 Openwire 端口,而 STOMP 端口通常为“61613”,因此我的建议是检查 STOMP 连接器绑定(bind)的端口并确保您正在连接到那个。

关于python - 无法使用 STOMP 将消息发送到 activemq,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56097047/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com