Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A simple implementation of STOMP with Django

Project description

Django Stomp

Build Status Maintainability Test Coverage Code style: black

A simple implementation of STOMP with Django.

It is heavily tied to ActiveMQ, but can work with any broker which supports STOMP with minor or none adjustments.

Installation

pip install django_stomp

Add django_stomp in your INSTALLED_APPS and so be it.

Configuration process

Not yet fully available, but feel free to see our tests to get insights.

Consumer

First you must create a function which receives an parameter of type django_stomp.services.consumer.Payload. Let's suppose the module app.sample with the following content:

import logging

from django_stomp.services.consumer import Payload

logger = logging.getLogger(__name__)


def my_honest_logic(payload: Payload) -> None:
    logger.info("Yeah, I received a payload from django-stomp!")

    my_payload = payload.body
    my_header = payload.headers

    if my_payload.get("my-dict-key"):
        payload.ack()
    else:
        logger.info("To DLQ!")
        payload.nack()

Now you must provide broker connection details filling out the following parameters at least:

  • STOMP_SERVER_HOST
  • STOMP_SERVER_PORT
  • STOMP_USE_SSL

And just create the job issuing the following command:

python manage.py pubsub "/queue/your-stuff" app.sample.my_honest_logic

That's it ✌️

Tests

In order to execute the tests, first do the following:

docker-compose up -d

Then:

pipenv run tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-stomp, version 0.0.21
Filename, size File type Python version Upload date Hashes
Filename, size django_stomp-0.0.21-py3-none-any.whl (11.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size django_stomp-0.0.21.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page