Skip to main content

A gevent based python client for NSQ.

Project description

https://img.shields.io/pypi/v/gnsq.svg https://img.shields.io/travis/wtolson/gnsq.svg Documentation Status

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

Usage

First make sure nsq is installed and running. Next create a producer and publish some messages to your topic:

import gnsq

producer = gnsq.Producer('localhost:4150')

producer.publish('topic', 'hello gevent!')
producer.publish('topic', 'hello nsq!')

Then create a Consumer to consume messages from your topic:

consumer = gnsq.Consumer('topic', 'channel', 'localhost:4150')

@consumer.on_message.connect
def handler(consumer, message):
    print 'got message:', message.body

consumer.start()

Compatibility

For NSQ 1.0 and later, use the major version 1 (1.x.y) of gnsq.

For NSQ 0.3.8 and earlier, use the major version 0 (0.x.y) of the library.

The recommended way to set your requirements in your setup.py or requirements.txt is:

# NSQ 1.x.y
gnsq>=1.0.0

# NSQ 0.x.y
gnsq<1.0.0

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.

Project details


Download files

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

Source Distribution

gnsq-1.0.1.tar.gz (44.3 kB view details)

Uploaded Source

Built Distribution

gnsq-1.0.1-py2.py3-none-any.whl (33.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file gnsq-1.0.1.tar.gz.

File metadata

  • Download URL: gnsq-1.0.1.tar.gz
  • Upload date:
  • Size: 44.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for gnsq-1.0.1.tar.gz
Algorithm Hash digest
SHA256 276b69b68211c9137cfcd7d630484573e83fa5f6d46349d5f9ca66bef5353f83
MD5 d0d1a391a0f29370483e03adec07134c
BLAKE2b-256 b50836e5b1a7c11cea824c3b573d7b0f74d9c13b2ab8fd4c61225da83711bc05

See more details on using hashes here.

Provenance

File details

Details for the file gnsq-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: gnsq-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for gnsq-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 08cf12d137bbf73a4ad845f62a6bdc6759378d0e2d23f973b635cadf6126a53d
MD5 622773c2dd76cb0ff570cf72b15c5e7d
BLAKE2b-256 8a17019ba6d25074d3f93a1d85c6074a2d9fcdf11d8855b7deb3d47e24d2bc8f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page