Skip to main content

Application to manage RabbitMQ queues

Project description

Rabbit queues

Application to manage RabbitMQ queues

Configuration

Into the setup.py file add:

INSTALLED_APPS = [
    ...
    "rabbitqueues",
]

and add (i.e.):

RABBITMQ_HOSTNAME = "localhost"
RABBITMQ_PORT = 5672
RABBITMQ_USERNAME = "rabbitusername"
RABBITMQ_PASSWORD = "supersecretpassword"
RABBITMQ_VHOST = "/"

Own consumers

To prepare own conumer you need to create class which will extend AbstractManager. and register it in dictionary RABBITMQ_QUEUE_CONSUMERS = {"consumer_name": consumer_class} in setup.py.

Publish to the queue example

import json
from django.conf import settings
from rabbitqueues import RabbitQueue


queue = RabbitQueue(settings.RABBITMQ_EMAIL_QUEUE)
queue.basic_publish(
    routing_key=settings.RABBITMQ_EMAIL_QUEUE,
    body=json.dumps(
        {
            "subject": "some subject",
            "email_from": settings.DEFAULT_FROM_EMAIL,
            "recipient_list": ["test@test.com"],
            "message": "This is the message for user.",
        }
    ),
)
queue.close()

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

rabbitqueues-beeflow-0.0.7.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

rabbitqueues_beeflow-0.0.7-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

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