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"
# We use declare_queue for both can operate independently and can be started in any order.
queue_mgr.declare_queue(queue_name)
# 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
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 rabbitmq_toolkit-0.1.7.tar.gz.
File metadata
- Download URL: rabbitmq_toolkit-0.1.7.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13ad479bd8572815bbfc6e8071daa093e328586df0f74e9ac3550621df2607ab
|
|
| MD5 |
6cb1598bbce83141255d8426b1c5bd54
|
|
| BLAKE2b-256 |
774b63f22dc57f7257bf9cfd47cdad2d2be6a51f32076872b7b8ab0b783095e4
|
File details
Details for the file rabbitmq_toolkit-0.1.7-py3-none-any.whl.
File metadata
- Download URL: rabbitmq_toolkit-0.1.7-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1037431baa81d19b5da7bb84853023e55e0cb1ab66d9d12201a82c8bf13b423e
|
|
| MD5 |
c86ae77319a3fadb16080d9ed0882eb8
|
|
| BLAKE2b-256 |
ab294602213db69dea3a41971f8ea2517f46ce7765d51cc5d2f5d394dd661711
|