use*_*128 2 python activemq-classic stomp
我正在尝试使用 STOMP 协议向我的 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: '
Run Code Online (Sandbox Code Playgroud)
我正在使用下面的 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()
Run Code Online (Sandbox Code Playgroud)
用于调用脚本的命令:
python receiver_topic.py heyhey
Run Code Online (Sandbox Code Playgroud)
我认为有一些东西需要添加到 activemq.xml 文件中。对此的任何建议都会非常有帮助。
从所提供的信息来看,您似乎正在连接到代理上的 Openwire 端口,该端口默认为“61616”,而 STOMP 端口通常为“61613”,因此我的建议是检查 STOMP 连接器绑定到哪个端口并确保您正在连接到那个。
| 归档时间: |
|
| 查看次数: |
2581 次 |
| 最近记录: |