A streamlined toolkit for efficient RabbitMQ operations.
Project description
RabbitMQ Toolkit
RabbitMQ Toolkit is a comprehensive package designed to simplify RabbitMQ operations. It encapsulates the core functionalities into three intuitive classes: QueueManager
, Producer
, and Consumer
, streamlining the process of message queueing, producing, and consuming.
Installation
Install the package via pip:
pip install rabbitmq_toolkit
Features
- QueueManager: Effortlessly manage your RabbitMQ queues.
- Producer: Produce messages with ease, ensuring they're properly queued.
- Consumer: Robustly consume messages, with built-in mechanisms to handle common scenarios.
Usage Example
Producer
In producer.py
:
from rabbitmq_toolkit import QueueManager, Producer
# Initialize the Queue Manager and declare a queue
queue_mgr = QueueManager()
queue_name = "sample_queue"
queue_mgr.declare_queue(queue_name)
# Produce a message
producer = Producer(queue_mgr)
producer.send_message(queue_name, "Hello from RabbitMQ Toolkit!")
Run producer.py
in terminal:
python producer.py
Consumer
In consumer.py
:
from rabbitmq_toolkit import QueueManager, Consumer
# Initialize the Queue Manager
queue_mgr = QueueManager()
queue_name = "sample_queue"
# Consume the message
def callback(message):
print(f"Received: {message}")
consumer = Consumer(queue_mgr)
consumer.start_consuming(queue_name, callback)
Run consumer.py
in other tab terminal:
python consumer.py
Note: This provides a clear distinction between the Producer and Consumer, showcasing how they can be used in separate files.
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
rabbitmq_toolkit-0.0.2.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for rabbitmq_toolkit-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55e61c594f327a032a6155d83cecca17a6a5e06204b275c9411ab4d4f3b364e5 |
|
MD5 | db91fdd58599314b3ef6de9449efd56b |
|
BLAKE2b-256 | 32fda6c040ed341d121a2cbb786b5bbf06e04b36ba101a495d71533c829d7ea1 |