Skip to main content

A gevent based python client for NSQ.

Project description

https://badge.fury.io/py/gnsq.svg https://travis-ci.org/wtolson/gnsq.svg?branch=master https://pypip.in/d/gnsq/badge.png

A gevent based python client for NSQ.

Features include:

  • Free software: BSD license
  • Documentation: http://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

To use gnsq in a project:

import gnsq
reader = gnsq.Reader('topic', 'channel', 'localhost:4150')

@reader.on_message.connect
def handler(reader, message):
    do_work(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.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
gnsq-0.1.4-py2.py3-none-any.whl (23.6 kB) Copy SHA256 hash SHA256 Wheel 2.7
gnsq-0.1.4.tar.gz (35.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page