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.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

PyRMQ-1.0.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: PyRMQ-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for PyRMQ-1.0.0.tar.gz
Algorithm Hash digest
SHA256 25e9d9c64d10a02b017be5d0893291d585ddc6e0b4dd9699f4bf198972dd95a4
MD5 212ec11e6a5caaefbe2fb88ad15b2583
BLAKE2b-256 17990b9e1f453dfbb1f07fc837a27de277e78f945426c14abfc7410af50f932c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: PyRMQ-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for PyRMQ-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbde53f0c276025d99d331e974686f0968adfc5f790768dcab9cd39d61b73478
MD5 e54a7ba16949cc2bd0e94ca82eabffb7
BLAKE2b-256 75b0b448b436b0ec0a9e9ab1889453bdd9f8ea527be369397234bcad66028155

See more details on using hashes here.

Supported by

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