Enabling SSL TLS1.2 in RabbitMQ in Python

21 views Asked by At

I have a code that connects to RabbitMQ that has SSL TLS1.2 enabled but throws error pika.exceptions.AMQPConnectionError, the issue is regarding the enablement of SSL settings in code in RabbitMQ connection.

class RabbitIOHandler(AbstractIOHandler):
def __init__(self, server_name, port, virtual_host, queue, exchange, user_name,
                 password, chunking=None, data_compactor=None, compress_threshold=None,
                 message_type=None):
        super().__init__()
        self._queue = queue
        self._exchange = exchange
        self._chunking = chunking
        self._data_compactor = data_compactor
        if compress_threshold is None:
            compress_threshold = np.inf
        self._compress_threshold = compress_threshold
        self._message_type = message_type

        user_name = urllib.parse.quote(user_name)
        password = urllib.parse.quote(password)
        url = f'amqp://{user_name}:{password}@{server_name}:{port}/{virtual_host}'

        self.connection_parameters = pika.connection.URLParameters(url+"?heartbeat=3600")
        self._set_basic_properites()
0

There are 0 answers