Skip to main content

Library to use Rabbit MQ in a quick and easy way

Project description

Quick RabbitMQ Python Library

Python License

This is a Python library designed to simplify communication with RabbitMQ, offering an easier and more secure way to consume and produce messages without the need to deeply study the official RabbitMQ documentation.

Features

  • Simple sending and receiving of messages with RabbitMQ.
  • Queue and connection management.
  • Support for multiple message types and serialization.
  • High flexibility to define custom consumers and producers.
  • Scalable for large volumes of messages.
  • Easy integration with existing applications.

Installation

  • First, make sure you have Python 3.8 or higher installed. Then, you can install the library using pip:
pip install quick_rabbit

Contributions

Contributions are welcome. If you have an idea, suggestion, or found a bug, please open an issue or a pull request.

  1. Fork this repository.
  2. Create a new branch (git checkout -b feature/new-feature).
  3. Make your changes and commit (git commit -am 'Add new feature').
  4. Push the branch (git push origin feature/new-feature).
  5. Open a Pull Request.

A Simple Example Consumer

import quick_rabbit as qr
import json


class your_objt(qr.RabbitMqClient):
    # It's important redefinne this method
    def callback(self, ch, method, properties, body):
        ch.basic_ack(delivery_tag=method.delivery_tag)
        self.body = json.loads(body) ## Necesary
        self.props = properties ## Necesary
        if self.queue == "your_queue":
            self.your_func()
            
    def your_func(self):
        ## logic here
        pass


def main():
    qr.consumer("RABBITMQ_HOSTNAME",
                int("RABBITMQ_PORT"),
                "RABBITMQ_USER",
                "RABBITMQ_PASS",
                int("RABBIT_TIMER"),
                "your queue",
                your_objt)

A Simple Example Producer

from quick_rabbit import get_data


def main(cmd, queue, data=None):
    return get_data("RABBITMQ_HOSTNAME",
                    int("RABBITMQ_PORT"),
                    "RABBITMQ_USER",
                    "RABBITMQ_PASS",
                    int("RABBIT_TIMER"),
                    cmd, queue, data)


res = main("get-cmd", "queue", {"key": "value"})

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

quick_rabbit-0.0.12.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

quick_rabbit-0.0.12-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file quick_rabbit-0.0.12.tar.gz.

File metadata

  • Download URL: quick_rabbit-0.0.12.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.7

File hashes

Hashes for quick_rabbit-0.0.12.tar.gz
Algorithm Hash digest
SHA256 f4ac77c60f45c3aad2087a1a5a938ece3764adfbf96492e195180af1e47d9b8a
MD5 eb5c5ab474a12c82fd0518a9d6eeea2f
BLAKE2b-256 aeaee03e382ad85ee07e0c872d4fde90d09d0a8e8e93e77844b2d1e812642c2e

See more details on using hashes here.

File details

Details for the file quick_rabbit-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for quick_rabbit-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 5fdbfdc07b9c00b0ac298853442742f13a466afcd79c870a110ff202b18f3cb6
MD5 b0434cde624aff4c25183f1286bfe283
BLAKE2b-256 acbe8c6a19d5e6eda49c79f4fce21fcc27b8f20b523679dd61656a20345540d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page