jasonrbriggs / stomp.py

“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

Amazon MQ. Stomp 6.1.0 #338

Closed usrlocalang closed 3 years ago

usrlocalang commented 3 years ago
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/stomp/transport.py", line 763, in attempt_connection
    self.socket = tls_context.wrap_socket(self.socket, server_hostname=host_and_port[0])
  File "/usr/lib64/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/usr/lib64/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/usr/lib64/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1091)

Traceback (most recent call last):
  File "lambda.py", line 47, in lambda_handler
    wait=False)
  File "/usr/local/lib/python3.7/site-packages/stomp/connect.py", line 161, in connect
    self.transport.start()
  File "/usr/local/lib/python3.7/site-packages/stomp/transport.py", line 105, in start
    self.attempt_connection()
  File "/usr/local/lib/python3.7/site-packages/stomp/transport.py", line 810, in attempt_connection
    raise exception.ConnectFailedException()
stomp.exception.ConnectFailedException

python 3.7 packages pyOpenSSL==20.0.0 stomp.py==6.1.0

Cannot connect to Amazon MQ.

        conn = stomp.Connection([
            (os.environ.get('ACTIVEMQ_HOST_TWO'),
             int(os.environ.get('ACTIVEMQ_PORT'))
            )],
        )
        conn.set_ssl(cert_file='certs/certificate.pem', key_file='certs/privateKey.key', ssl_version=ssl.PROTOCOL_TLSv1_2, 
                     for_hosts=[(os.environ.get('ACTIVEMQ_HOST_TWO'), int(os.environ.get('ACTIVEMQ_PORT'))])
jasonrbriggs commented 3 years ago

Don't think it's a stomp.py issue necessarily -- I see the same thing reported with python-requests here: https://stackoverflow.com/questions/14102416/python-requests-requests-exceptions-sslerror-errno-8-ssl-c504-eof-occurred