/aio-pika

AMQP 0.9 client designed for asyncio and humans.

Primary LanguagePythonApache License 2.0Apache-2.0

aio-pika

ReadTheDocs

Coveralls

Drone CI

Latest Version

image

image

image

Wrapper for the aiormq for asyncio and humans.

Note

Since version 5.0.0 this library doesn't use pika as AMQP connector. Versions below 5.0.0 contains or requires pika's source codes.

See examples and the tutorial in documentation.

If you are newcomer in the RabbitMQ let's start the adopted official RabbitMQ tutorial

Features

  • Completely asynchronous API.
  • Object oriented API.
  • Transparent auto-reconnects with complete state recovery with connect_robust (e.g. declared queues or exchanges, consuming state and bindings).
  • Python 3.5+ compatible (include 3.7).
  • For python 3.4 users available aio-pika<4
  • Transparent publisher confirms support
  • Transactions support

Installation

pip install aio-pika

Usage example

Simple consumer:

Simple publisher:

Get single message example:

See another examples and the tutorial in documentation.

Versioning

This software follows Semantic Versioning

For contributors

Setting up development environment

Clone the project:

git clone https://github.com/mosquito/aio-pika.git
cd aio-pika

Create a new virtualenv for aio_pika:

virtualenv -p python3.5 env

Install all requirements for aio_pika:

env/bin/pip install -e '.[develop]'

Running Tests

NOTE: In order to run the tests locally you need to run a RabbitMQ instance with default user/password (guest/guest) and port (5672).

  • ProTip: Use Docker for this:

To test just run:

Creating Pull Requests

You feel free to create pull request, but you should describe your cases and add some examples.

The changes should follow simple rules:

  • When your changes breaks public API you must increase the major version.
  • When your changes is safe for public API (e.g. added an argument with default value)
  • You have to add test cases (see tests/ folder)
  • You must add docstrings
  • You feel free to add yourself to "thank's to" section