A gevent based python client for the NSQ distributed messaging platform.
Python Makefile
Latest commit 970b03f Sep 26, 2016 @wtolson Bump version to 0.3.3.
Permalink
Failed to load latest commit information.
docs
gnsq Bump version to 0.3.3. Sep 26, 2016
tests
.gitignore Add packaging skeleton for release. May 9, 2014
.travis.yml
AUTHORS.rst Conform to cookiecutter-pypackage. Jun 30, 2014
CONTRIBUTING.rst
HISTORY.rst
LICENSE Conform to cookiecutter-pypackage. Jun 30, 2014
MANIFEST.in
Makefile
README.rst
requirements.txt
setup.cfg
setup.py
tox.ini

README.rst

gnsq

https://img.shields.io/pypi/v/gnsq.svg?style=flat https://img.shields.io/travis/wtolson/gnsq/master.svg?style=flat https://img.shields.io/pypi/dm/gnsq.svg?style=flat

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+, Python 3.3+ and PyPy.

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.