Skip to content

Commit

Permalink
pass Conn.connection_parameters, not just raw NamedTuple, to pika.Blo…
Browse files Browse the repository at this point in the history
…ckingConnection
  • Loading branch information
mackenzie-grimes-noaa committed Oct 24, 2024
1 parent bf65805 commit 925b5de
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/idsse_common/idsse/common/rabbitmq_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ def _initialize_connection_and_channel(
# connection of unsupported type passed
raise ValueError(
(f'Cannot use or create new RabbitMQ connection using type {type(connection)}. '
'Should a Conn (a dict with connection parameters)')
'Should be type Conn (a dict with connection parameters)')
)

_connection = BlockingConnection(parameters=connection)
_connection = BlockingConnection(connection.connection_parameters)
logger.info('Established new RabbitMQ connection to %s on port %i',
connection.host, connection.port)

Expand Down Expand Up @@ -352,7 +352,7 @@ class Consumer(Thread):
"""
def __init__(
self,
conn_params: ConnectionParameters,
conn_params: Conn,
rmq_params_and_callbacks: RabbitMqParamsAndCallback | list[RabbitMqParamsAndCallback],
num_message_handlers: int,
*args,
Expand All @@ -366,7 +366,7 @@ def __init__(
self._rmq_params_and_callbacks = rmq_params_and_callbacks
else:
self._rmq_params_and_callbacks = [rmq_params_and_callbacks]
self.connection = BlockingConnection(parameters=self._conn_params)
self.connection = BlockingConnection(self._conn_params.connection_parameters)
self.channel = self.connection.channel()

self._consumer_tags = []
Expand Down Expand Up @@ -420,7 +420,7 @@ class Publisher(Thread):
"""
def __init__(
self,
conn_params: ConnectionParameters,
conn_params: Conn,
exch_params: Exch,
*args,
**kwargs,
Expand All @@ -431,7 +431,7 @@ def __init__(
self._exch = exch_params
self._queue = None

self.connection = BlockingConnection(conn_params)
self.connection = BlockingConnection(conn_params.connection_parameters)
self.channel = self.connection.channel()

# if delivery is mandatory there must be a queue attach to the exchange
Expand Down

0 comments on commit 925b5de

Please sign in to comment.