“stomp.py” is a Python client library for accessing messaging servers (such as ActiveMQ or RabbitMQ) using the STOMP protocol (versions 1.0, 1.1 and 1.2). It can also be run as a standalone, command-line client for testing.
Apache License 2.0
495
stars
167
forks
source link
not able to connect to activemq broker of aws active mq #377
import stomp
#Establish a connection
con = stomp.Connection([('stomp+ssl://xxxxxxxxxxxxxxxxxx.mq.xxxxxxxxxxxxxxxx.amazonaws.com',61616)])
#listener class to be instantiated.
class Listener(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)
con.set_listener('', Listener())
#wait will ensure it waits till connection is established and acknowledged.
# con.start()
con.connect('xxxxxxxx', 'xxxxxxxxx', wait=True)
#subscribe to a particular topic or queue by giving the path and headers if required by the server.
con.subscribe('#', headers={})
Error:
Could not connect to host stomp+ssl://xxxxxxxxxxxxxxxxxxxx.mq.xxxxxxx.amazonaws.com, port 61616
Could not connect to host stomp+ssl://xxxxxxxxxxxxxxxxxxxx.mq.xxxxxxx.amazonaws.com, port 61616
Could not connect to host stomp+ssl://xxxxxxxxxxxxxxxxxxxx.mq.xxxxxxx.amazonaws.com, port 61616
Traceback (most recent call last):
File "stomp_mqtt_subscribe.py", line 34, in <module>
con.connect('xxxxxxxx', 'xxxxxxxx', wait=True)
File "/home/ubuntu/.local/lib/python3.8/site-packages/stomp/connect.py", line 150, in connect
self.transport.start()
File "/home/ubuntu/.local/lib/python3.8/site-packages/stomp/transport.py", line 130, in start
self.attempt_connection()
File "/home/ubuntu/.local/lib/python3.8/site-packages/stomp/transport.py", line 834, in attempt_connection
raise exception.ConnectFailedException()
stomp.exception.ConnectFailedException
code:
Error:
Any help appreciated.