A distributed messaging library similar to rq built on top of Redis
Project description
xq
A distributed queue system built on top of Redis
install
pip3 install -r requirements.txt
Use
Producer
import redis
from xq.queue import Queue
# connect to Redis
r = redis.Redis(host='localhost', port=6379)
# create queue
q = Queue(r, "test_queue")
# enqueue
q.enqueue("this is a message")
Consumer
import redis
from xq.queue import Queue
# connect to Redis
r = redis.Redis(host='localhost', port=6379)
# create queue
q = Queue(r, "test_queue")
# poll
messages = q.poll()
for message in messages:
print(message.body)
Use Worker
import redis
from xq.queue import Queue
from xq.worker import Worker
# connect to Redis
r = redis.Redis(host='localhost', port=6379)
# create queue
q = Queue(r, "test_queue")
worker = Worker(q, process_message)
worker.run()
def process_message(message):
print(message)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xqueue-0.0.1.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file xqueue-0.0.1.tar.gz
.
File metadata
- Download URL: xqueue-0.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae5978624bb833cabc838d7e5b82119dafeccaec92d4c52ae454fcb96051845e |
|
MD5 | 87834c973f7a7156fe9423a43958dc9c |
|
BLAKE2b-256 | 3f47a69f886674f6e55c2d0291b7543a82e848c78b39cf538e813740a6f73c23 |
File details
Details for the file xqueue-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: xqueue-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11aac209dd6a793035849ae4ad368bf14dce80674a98e9a228fc4b9ce9ae5241 |
|
MD5 | 03e5123caba8bbe5c07e173c20b0daaf |
|
BLAKE2b-256 | 6eac20fee018b5f53cd72580470ba5a7f79f235c49daeaf4069fc0d3c07e167e |