Skip to main content

Python with RabbitMQ—simplified so you won't have to.

Project description

PyRMQ

GitHub Workflow Status PyPI Documentation Status Codecov Supports Python >= 3.5 License Code style: black

Python with RabbitMQ—simplified so you won't have to.

Features

Stop worrying about boilerplating and implementing retry logic for your queues. PyRMQ already does it for you.

  • Use out-of-the-box and thread-safe Consumer and Publisher classes created from pika for your projects and tests.
  • Built-in retry-backoff logic for connecting, consuming, and publishing.
  • Works with Python 3.
  • Production ready

Getting Started

Installation

PyRMQ is available at PyPi.

pip install pyrmq

Usage

Publishing

Just instantiate the feature you want with their respective settings. PyRMQ already works out of the box with RabbitMQ's default initialization settings.

from pyrmq import Publisher
publisher = Publisher(
    exchange_name="exchange_name",
    queue_name="queue_name",
    routing_key="routing_key",
)
publisher.publish({"pyrmq": "My first message"})

Consuming

Intantiating a Consumer automatically starts it in its own thread making it non-blocking by default. When run after the code from before, you should be able to receive the published data.

from pyrmq import Consumer

def callback(data):
    print(f"Received {data}!")

consumer = Consumer(
    exchange_name="exchange_name",
    queue_name="queue_name",
    routing_key="routing_key",
    callback=callback
)
consumer.start()

Documentation

Visit https://pyrmq.readthedocs.io for the most up-to-date documentation.

Testing

For development, just run:

pytest

To test for all the supported Python versions:

pip install tox
tox

To test for a specific Python version:

tox -e py38

Project details


Download files

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

Source Distribution

PyRMQ-1.0.1.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

PyRMQ-1.0.1-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page