Skip to main content

RabbitMQ AMQP 1.0 Python Client

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

Version 2.0 is coming

Please follow the version 2.0 Consider upgrading the library to version 2.0. Check the 2.x releases

Install

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.

Metadata

Release files for rabbitmq-amqp-python-client 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rabbitmq-amqp-python-client 1.0.1
File Size Uploaded
rabbitmq_amqp_python_client-1.0.1.tar.gz 119.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rabbitmq-amqp-python-client 1.0.1
File Interpreter ABI Platform
rabbitmq_amqp_python_client-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 269.6 kB

Release files / rabbitmq_amqp_python_client-1.0.1.tar.gz

Download URL rabbitmq_amqp_python_client-1.0.1.tar.gz
Size 119.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3996a4a14c78a80563d0ee41b1a1796bd0f59b0f9bd2bceef9a3c78fd2f22226
BLAKE2b-256 checksum
How to use checksums
b5ea02cfcb579ce4695bbbdded6937e378a1916599f6420175f72d9c4076f783
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rabbitmq_amqp_python_client-1.0.1-py3-none-any.whl

Download URL rabbitmq_amqp_python_client-1.0.1-py3-none-any.whl
Size 149.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c2bd233ea695f77c51c153deff482580041910967c08f035f84fa1384a65d2e
BLAKE2b-256 checksum
How to use checksums
18e43997f2049aea7c71ac1dcf6df75a8fadc3b7783713db739d108b058f1ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14
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