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.2.tar.gz (8.4 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.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: PyRMQ-1.0.2.tar.gz
  • Upload date:
  • Size: 8.4 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.2.tar.gz
Algorithm Hash digest
SHA256 2a787d81ff1caa2389a48f174818d2840ad846f1d2fe1bc74e7dd727c87f19c2
MD5 4ad2cd8f97522aa593ea9a38b36ebf01
BLAKE2b-256 eb28374096f5e4d95ad9a207a602f21d7c0552e901819952134956e80300496d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: PyRMQ-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e926436e282df4396b8b02aea50e016d00c3820b61781c141c4231a83a4913
MD5 9d29ce01c1582bb32dc302194eb110f8
BLAKE2b-256 c0a395fb3b487d5ab2f9b89f3bd88e23f53626488a38d20fb17a0ffe9095da4a

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