Skip to main content

RabbitMQ AMQP 1.0 Python Client

This library is meant to be used with RabbitMQ 4.x.

The client is distributed via PIP:

 pip install rabbitmq-amqp-python-client

Getting Started

Inside the examples folder you can find a set of examples that show how to use the client.

Documentation

Client Guide select the python section.

Build

  • make rabbitmq-server: run the RabbitMQ server in a docker container
  • poetry build: build the source project
  • poetry install: resolves and install dependencies
  • make test: run the tests

Note for MAC users:

To run TLS you need to:

- pip uninstall python-qpid-proton
- brew install swig
- brew install pkg-config
- export CFLAGS="-I/usr/local/opt/openssl/include"; pip install python-qpid-proton --verbose --no-cache-dir

Read more about the issue here

SSL Problems in local environment

If when running tests, this exceptions is raised by the proton library: SSLUnavailable:

pip uninstall python-qpid-proton -y

sudo apt-get update
sudo apt-get install -y swig cmake build-essential libssl-dev pkg-config

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
export CFLAGS="-I/usr/include/openssl"
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu"

pip install "python-qpid-proton>=0.39.0,<0.40.0" --no-binary python-qpid-proton --verbose --no-cache-dir

Async Interface

The client provides an async interface via the rabbitmq_amqp_python_client.asyncio module. The async classes act as facades that:

  • Wrap the corresponding synchronous classes
  • Execute blocking operations in a thread pool executor using run_in_executor
  • Coordinate concurrent access using asyncio.Lock
  • Implement proper async context managers (async with) for resource management
  • Maintain API compatibility with the synchronous version

Key differences from the synchronous interface:

  1. Use AsyncEnvironment instead of Environment
  2. All operations must be awaited with await
  3. Use async with for resource management (connections, publishers, consumers, management)
  4. Consumer signal handling uses asyncio.Event and loop.add_signal_handler

For a complete example showing proper consumer termination and signal handling, refer to:

Additional async examples are available in the examples folder:

Thread Safety

The TCP connection is not thread safe. If you want to use the client in a multithreaded environment, you should create a connection per thread.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rabbitmq_amqp_python_client-1.0.0.tar.gz (119.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rabbitmq_amqp_python_client-1.0.0-py3-none-any.whl (149.6 kB view details)

Uploaded Python 3

File details

Details for the file rabbitmq_amqp_python_client-1.0.0.tar.gz.

File metadata

File hashes

Hashes for rabbitmq_amqp_python_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e0a9edfff3a00d5f684d006cba4530fbd58d3a3bac025e28fe945c9f05cec1a7
MD5 dd0565457b04ade72f1f88b7f196fe0e
BLAKE2b-256 1b0cc46b4ed5aa90767e46235607a98b1f8ce8003e596734b7c7394117eaa858

See more details on using hashes here.

File details

Details for the file rabbitmq_amqp_python_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rabbitmq_amqp_python_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dfbe687797cc883ab21394ed9087c536428a9dbd3bdcbf1028843f1b8922825f
MD5 2610de8dd4bd75e44db9b330b99ca418
BLAKE2b-256 4a0bb113e0ec1afdf0d381591a2f8522ce3cf8b19d60ebef17f7bb7545e16000

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page