pynenc_rabbitmq.util.rabbitmq_conn_mng

RabbitMQ connection management with thread safety.

Module Contents

Classes

ConnectionManager

Manages RabbitMQ connections with thread safety using thread-local storage.

Data

API

pynenc_rabbitmq.util.rabbitmq_conn_mng.logger

‘getLogger(…)’

class pynenc_rabbitmq.util.rabbitmq_conn_mng.ConnectionManager(conf: pynenc_rabbitmq.conf.config_rabbitmq.ConfigRabbitMq)[source]

Manages RabbitMQ connections with thread safety using thread-local storage.

Initialization

_get_connection_parameters() pika.ConnectionParameters[source]

Create connection parameters from configuration.

Returns:

Configured connection parameters for RabbitMQ

_ensure_connection() pika.BlockingConnection[source]

Ensure we have a valid thread-local connection.

Creates one connection per thread since BlockingConnection is not thread-safe.

Returns:

Active BlockingConnection instance for current thread

get_channel() Generator[pika.adapters.blocking_connection.BlockingChannel, None, None][source]

Get a channel within a context manager for safe cleanup.

Each thread gets its own connection, and channels are created per operation.

Returns:

Generator yielding an open channel

close() None[source]

Close the thread-local connection if open.