rabbitmq-toolkit


Namerabbitmq-toolkit JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/your_username/rabbitmq_toolkit
SummaryA streamlined toolkit for efficient RabbitMQ operations.
upload_time2023-10-24 07:53:49
maintainer
docs_urlNone
authorInfinity Team
requires_python>=3.6
license
keywords rabbitmq messaging queue producer consumer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
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`:

```python
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:
```bash
python producer.py
```

### Consumer

In `consumer.py`:

```python
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:
```bash
python consumer.py
```

**Note:** This provides a clear distinction between the Producer and Consumer, showcasing how they can be used in separate files.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/your_username/rabbitmq_toolkit",
    "name": "rabbitmq-toolkit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "rabbitmq,messaging,queue,producer,consumer",
    "author": "Infinity Team",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/77/4b/63f22dc57f7257bf9cfd47cdad2d2be6a51f32076872b7b8ab0b783095e4/rabbitmq_toolkit-0.1.7.tar.gz",
    "platform": null,
    "description": "# RabbitMQ Toolkit\r\n\r\nRabbitMQ 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.\r\n\r\n## Installation\r\n\r\nInstall the package via pip:\r\n\r\n```bash\r\npip install rabbitmq_toolkit\r\n```\r\n\r\n\r\n## Features\r\n\r\n- **QueueManager**: Effortlessly manage your RabbitMQ queues.\r\n- **Producer**: Produce messages with ease, ensuring they're properly queued.\r\n- **Consumer**: Robustly consume messages, with built-in mechanisms to handle common scenarios.\r\n\r\n## Usage Example\r\n\r\n### Producer\r\n\r\nIn `producer.py`:\r\n\r\n```python\r\nfrom rabbitmq_toolkit import QueueManager, Producer\r\n\r\n# Initialize the Queue Manager and declare a queue\r\nqueue_mgr = QueueManager()\r\nqueue_name = \"sample_queue\"\r\nqueue_mgr.declare_queue(queue_name)\r\n\r\n# Produce a message\r\nproducer = Producer(queue_mgr)\r\nproducer.send_message(queue_name, \"Hello from RabbitMQ Toolkit!\")\r\n```\r\n\r\nRun `producer.py` in terminal:\r\n```bash\r\npython producer.py\r\n```\r\n\r\n### Consumer\r\n\r\nIn `consumer.py`:\r\n\r\n```python\r\nfrom rabbitmq_toolkit import QueueManager, Consumer\r\n\r\n# Initialize the Queue Manager\r\nqueue_mgr = QueueManager()\r\nqueue_name = \"sample_queue\"\r\n# We use declare_queue for both can operate independently and can be started in any order.\r\nqueue_mgr.declare_queue(queue_name)\r\n\r\n# Consume the message\r\ndef callback(message):\r\n    print(f\"Received: {message}\")\r\n\r\nconsumer = Consumer(queue_mgr)\r\nconsumer.start_consuming(queue_name, callback)\r\n```\r\n\r\nRun `consumer.py` in other tab terminal:\r\n```bash\r\npython consumer.py\r\n```\r\n\r\n**Note:** This provides a clear distinction between the Producer and Consumer, showcasing how they can be used in separate files.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A streamlined toolkit for efficient RabbitMQ operations.",
    "version": "0.1.7",
    "project_urls": {
        "Homepage": "https://github.com/your_username/rabbitmq_toolkit"
    },
    "split_keywords": [
        "rabbitmq",
        "messaging",
        "queue",
        "producer",
        "consumer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab294602213db69dea3a41971f8ea2517f46ce7765d51cc5d2f5d394dd661711",
                "md5": "c86ae77319a3fadb16080d9ed0882eb8",
                "sha256": "1037431baa81d19b5da7bb84853023e55e0cb1ab66d9d12201a82c8bf13b423e"
            },
            "downloads": -1,
            "filename": "rabbitmq_toolkit-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c86ae77319a3fadb16080d9ed0882eb8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4611,
            "upload_time": "2023-10-24T07:53:47",
            "upload_time_iso_8601": "2023-10-24T07:53:47.932017Z",
            "url": "https://files.pythonhosted.org/packages/ab/29/4602213db69dea3a41971f8ea2517f46ce7765d51cc5d2f5d394dd661711/rabbitmq_toolkit-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "774b63f22dc57f7257bf9cfd47cdad2d2be6a51f32076872b7b8ab0b783095e4",
                "md5": "6cb1598bbce83141255d8426b1c5bd54",
                "sha256": "13ad479bd8572815bbfc6e8071daa093e328586df0f74e9ac3550621df2607ab"
            },
            "downloads": -1,
            "filename": "rabbitmq_toolkit-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "6cb1598bbce83141255d8426b1c5bd54",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3714,
            "upload_time": "2023-10-24T07:53:49",
            "upload_time_iso_8601": "2023-10-24T07:53:49.039462Z",
            "url": "https://files.pythonhosted.org/packages/77/4b/63f22dc57f7257bf9cfd47cdad2d2be6a51f32076872b7b8ab0b783095e4/rabbitmq_toolkit-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-24 07:53:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "your_username",
    "github_project": "rabbitmq_toolkit",
    "github_not_found": true,
    "lcname": "rabbitmq-toolkit"
}
        
Elapsed time: 0.63349s