Skip to content

iterativ/asgi-rabbitmq

Repository files navigation

asgi_rabbitmq

Build Status Coverage Status

RabbitMQ backend for ASGI.

ASGI is a standard interface between network protocol servers (particularly web servers) and Python applications (Django Channels), intended to allow handling of multiple common protocol styles (including HTTP, HTTP2, and WebSocket).

Channels loads into Django as a pluggable app to bring WebSocket, long-poll HTTP, task offloading and other asynchrony support to your code, using familiar Django design patterns and a flexible underlying framework that lets you not only customize behaviours but also write support for your own protocols and needs.

docs/img/infrastructure.png

Installation

You can install the most recent available version from PyPI:

pip install asgi_rabbitmq

Usage

To use RabbitMQ broker as your channels layer add following lines to your django settings

CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'asgi_rabbitmq.RabbitmqChannelLayer',
        # Change according to your project layout:
        'ROUTING': 'myproject.routing.routes',
        'CONFIG': {
            'url': 'amqp://guest:guest@rabbitmq:5672/%2F',
        },
    },
}

Now you can use channels project as usual:

daphne myproject.asgi:channel_layer
django-admin runworker

License

ASGI RabbitMQ layer is offered under 3-terms BSD license.