Styx is a simple library that turns a bunch of standalone Redis servers into a powerful distributed queue. The redis servers don’t need any special configuration or even be aware of each other in any way. The messages are loosely ordered. A java version can be found here. The java and python versions are compatible - i.e. messages published by one client can be read by the other client.
Install
pip install styx
Quickstart
#!/usr/bin/env python
# encoding: utf-8
import styx
# Define the Redis host locations (the default port is 6379)
hosts = [ "redis1.example.com", "redis2.example.com:8080", "redis3.example.com" ]
connection = styx.Styx(hosts, db=3) # default db is 0
# If a queue doesn't exist, it will be created automatically
q = connection.get_queue("myTestQueue")
q.put("Hello")
q.put("World")
q.put("Message1234")
q.get() # returns "Hello"
q.get() # returns "World"
# Check how many messages are left in the queue
q.size() # returns 1
# Delete this queue
connection.delete_queue(q)
Unit Tests
To run unit tests, make sure you have 3 redis instances running on localhost at ports 6700, 6701, 6702.
pip install nose
nosetests
Source available on GitHub: http://github.com/abh1nav/styx-python/
Metadata
Release files for styx 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| styx-0.1.2.tar.gz | 3.5 kB | Details |
Release files / styx-0.1.2.tar.gz
| Download URL | styx-0.1.2.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de57e2c622165cee10e32131a16a0e36be04974e07bcf146384972d8f0181aea
|
|
BLAKE2b-256 checksum How to use checksums |
a4767e983f644acd9e8f3a99202dbe152357bd09e511ad6c6b47d7dd0b955725
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |