A gevent based python client for NSQ.
Project description
A gevent based python client for NSQ distributed messaging platform.
Features include:
Free software: BSD license
Documentation: https://gnsq.readthedocs.org
Battle tested on billions and billions of messages </sagan>
Based on gevent for fast concurrent networking
Fast and flexible signals with Blinker
Automatic nsqlookupd discovery and back-off
Support for TLS, DEFLATE, and Snappy
Full HTTP clients for both nsqd and nsqlookupd
Installation
At the command line:
$ easy_install gnsq
Or even better, if you have virtualenvwrapper installed:
$ mkvirtualenv gnsq $ pip install gnsq
Currently there is support for Python 2.6 and Python 2.7. Support for Python 3 is dependent on gevent support.
Usage
First make sure nsq is installed and running. Next create a nsqd connection and publish some messages to your topic:
import gnsq conn = gnsq.Nsqd(address='localhost', http_port=4151) conn.publish('topic', 'hello gevent!') conn.publish('topic', 'hello nsq!')
Then create a Reader to consume messages from your topic:
reader = gnsq.Reader('topic', 'channel', 'localhost:4150') @reader.on_message.connect def handler(reader, message): print 'got message:', message.body reader.start()
Dependencies
Optional snappy support depends on the python-snappy package which in turn depends on libsnappy:
# Debian $ sudo apt-get install libsnappy-dev # Or OS X $ brew install snappy # And then install python-snappy $ pip install python-snappy
Contributing
Feedback, issues, and contributions are always gratefully welcomed. See the contributing guide for details on how to help and setup a development environment.
History
0.2.1 (2014-01-12)
Topics and channels are now valid to 64 characters.
Ephemeral topics are now valid.
Adjustable backoff behaviour.
0.2.0 (2014-08-03)
Warn on connection failure.
Add extra requires for snappy.
Add support for nsq auth protocal.
0.1.4 (2014-07-24)
Preemptively update ready count.
Dependency and contributing documentation.
Support for nsq back to 0.2.24.
0.1.3 (2014-07-08)
Block as expected on start, even if already started.
Raise runtime error if starting the reader without a message handler.
Add on_close signal to the reader.
Allow upgrading to tls+snappy or tls+deflate.
0.1.2 (2014-07-08)
Flush delfate buffer for each message.
0.1.1 (2014-07-07)
Fix packaging stream submodule.
Send queued messages before closing socket.
Continue to read from socket on EAGAIN
0.1.0 (2014-07-07)
First release on PyPI.
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
Built Distribution
File details
Details for the file gnsq-0.2.1.tar.gz
.
File metadata
- Download URL: gnsq-0.2.1.tar.gz
- Upload date:
- Size: 36.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4765c3ade1c99e1dcf0931aebf925118570b7c0cfa98c3a2f9dc5dfc156832fd |
|
MD5 | 801a1cb2fc72e3118233fca8dd802531 |
|
BLAKE2b-256 | 967abb8ef471f0b448603cd697e8863251d14e62a620ea56a1f974541c40ea8f |
Provenance
File details
Details for the file gnsq-0.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: gnsq-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58e98e0109ac6b17e1bbe8ce1df3131494a9a6db558c2ba250ecedaea84e4342 |
|
MD5 | 68062ca93485f9db96239bcd8fdad22d |
|
BLAKE2b-256 | a1058a02769fe4be1c7b50c55ada4b25580e7859bb708a8c0764983fa5671ceb |