Library to create simple rabbitmq workers resilient to connection/channel shutdown and simple producers.
Project description
RabbitmqWorker - Python worker for Rabbitmq
RabbitmqWorker is a worker for rabbitmq which automatically reconnect to the broker if any disconnection occurs.
Why?
The main library used to manage asynchronous tasks in python is Celery. Celery has its own internal message pattern that must be respected for celery to be able to interpret the messages correctly. In our architecture, we use microservices with multiple language where their task client does not follow Celery's message principle.
The scope of this library is to make an simple library to manage every kind of message from rabbitmq.
Installation
RabbitmqWorker is avaiable from PyPI. You can install it with pip.
$ pip install rabbitmq_worker
Usage
Instanciate a RabbitmqWorker
with the appropriate configuration to your needs and run it. E.g:
def process_message(channel, basic_deliver, properties, body):
print(body)
channel.basic_ack(basic_deliver.delivery_tag)
rabbitmq_worker = RabbitmqWorker(
amqp_url="amqp://guest:guest@localhost:5672/%2F",
queue_name="my_queue",
callback=process_message
)
rabbitmq_worker.run()
RabbitmqWorker use pika under the hood so your amqp_url must be compliant with URLParameters
(https://pika.readthedocs.io/en/stable/modules/parameters.html#urlparameters) object.
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
Built Distribution
File details
Details for the file rabbitmq_worker-0.0.7.tar.gz
.
File metadata
- Download URL: rabbitmq_worker-0.0.7.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bedbca32c0140f0134b48b42533ab28486ef05e0cd80fb623d1dfacfce4f9f7c |
|
MD5 | 8a996a557a7e20d092130a3684d9f45a |
|
BLAKE2b-256 | 700032b724b3fcbeda664f72ec4dca8fe6520c4c9dc6a28284b8bd4bc3e9157b |
File details
Details for the file rabbitmq_worker-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: rabbitmq_worker-0.0.7-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae43df3043de850e2d213a7bdf8e85e4d1692d021f11e8e5e8861827051cc58 |
|
MD5 | 0c00572f1298d1d02cd25add6e18b482 |
|
BLAKE2b-256 | 784f927d56f6409bf4b2ef5b3a2a47c353095b08205c56c15df00c791ce7b39c |