Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/franciscoda/channels_zmq
ZeroMQ Channels layer implementation
https://github.com/franciscoda/channels_zmq
channels django django-channels zeromq
Last synced: 10 days ago
JSON representation
ZeroMQ Channels layer implementation
- Host: GitHub
- URL: https://github.com/franciscoda/channels_zmq
- Owner: FranciscoDA
- License: gpl-3.0
- Created: 2023-05-09T10:39:31.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-05-11T16:26:43.000Z (over 1 year ago)
- Last Synced: 2024-11-24T22:06:30.748Z (28 days ago)
- Topics: channels, django, django-channels, zeromq
- Language: Python
- Homepage: https://pypi.org/project/channels-zmq/0.1.0/
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Authors: AUTHORS.rst
Awesome Lists containing this project
README
# channels_zmq
[![Tests status](https://github.com/FranciscoDA/channels_zmq/actions/workflows/tests.yml/badge.svg)](https://github.com/FranciscoDA/channels_zmq/actions/workflows/tests.yml)
[![PyPI](https://img.shields.io/pypi/v/channels-zmq)](https://pypi.org/project/channels-zmq/)A channel layer implementation using ZeroMQ PUB-SUB topology.
### Installation
Install package from PyPI:
```sh
pip install channels-zmq
```### Usage
Configure the layer in your Django settings file. You can choose one of the two implementations described below:
##### Embedded layer
```py
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_zmq.core.EmbeddedZmqChannelLayer",
"CONFIG": {
"pub_socket_address": "",
"capacity": 100,
"expiry": 60,
},
},
}
```The embedded layer binds a ZeroMQ PUB socket inside the process that calls `send` or `group_send`.
Consumers will connect their SUB sockets to the same socket.While this is a very lightweight implementation, it only allows a single process to call `send` and `group_send` with
the same layer.If you need to send data created through other processes, you should create a different layer or use the [dedicated layer](#dedicated-layer).
```
+----------------+
|PRODUCER PROCESS|
|----------------|
| PUB SOCKET |
+----------------+
^ ^ ^
| | |
+-----------+ | +----------+
| | |
+------------+ +------------+ +------------+
| SUB SOCKET | | SUB SOCKET | | SUB SOCKET |
|------------| |------------| |------------|
| CONSUMER 1 | | CONSUMER 2 | | CONSUMER 3 |
+------------+ +------------+ +------------+
```##### Dedicated layer
```py
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_zmq.core.DedicatedZmqChannelLayer",
"CONFIG": {
"pull_socket_address": "",
"pub_socket_address": "