Python with RabbitMQ—simplified so you won't have to.
Project description
Development Status
Note: Currently under active development.
Features
- Use out-of-the-box and thread-safe
ConsumerandPublisherclasses created frompikafor your projects and tests. - Built-in retry-backoff logic for connecting, consuming, and publishing.
- Works with Python 3.
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(
exchange_name="exchange_name",
queue_name="queue_name",
routing_key="routing_key",
callback=callback
)
Documentation
Complete document is found at https://pyrmq.readthedocs.io
run build and generate coverage report.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PyRMQ-0.1.0.tar.gz.
File metadata
- Download URL: PyRMQ-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fb218f9c39c3b7df7215aa6a894a624495668f6f043dd5eed332ae8bba0df98
|
|
| MD5 |
e090888024e848dac4aa287fa027ae34
|
|
| BLAKE2b-256 |
cee398ed9b382def162824c6e39a1412b85f99787bcb6d7b8ebd7d45ac3d71bb
|
File details
Details for the file PyRMQ-0.1.0-py3-none-any.whl.
File metadata
- Download URL: PyRMQ-0.1.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/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a60c8b04412c4102a9b41fe77a05fc64909a574c5263caace6ff373bea14ed8
|
|
| MD5 |
4073b760da1125660a9259b3558c3791
|
|
| BLAKE2b-256 |
1055cbcc204dd2d38fda5bcb26b0200cd0c757add1431fd05940b1fc9a63cec4
|