This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

NATS Documentation

HOW TO microservice communication.

How do I get my services to talk to each other with out registering each one in a directory?

How do I scale a back end service and allow front end services to use all of them quickly?

How do I have a fast, scalable, resilient communication service with out a lot of headaches?

A good answer to all of these is to use NATS. NATS is a masterpiece protocol designed with the cloud in mind. HTTP was good, but it was designed for servers sending single resources to clients on an uncontrolled network.

Install dependencies

I suggest creating a virtualenv.

$ make deps

Try the demo:

$ make prepare-example

Open two extra terminal windows and from one run:

$ ./example/respond.py

from the other run:

$ ./example/sub_only.py

Then from the first window run:

./example/nats_demo.py

Usage

Make a subject subscriber.

for full context see sub_only.py:

First, define a message handler for a subscription:

def on_happy_msg(nats_protocol, sid, subject, reply_to, payload):
    print "got message", sid, subject

Then in create the endpoint, nats protocol instance and connect them:

point = TCP4ClientEndpoint(reactor, "demo.nats.io", 4222)

nats_protocol = txnats.io.NatsProtocol(
    verbose=False,
    on_connect=lambda np: np.sub("happy", "6", on_msg=on_happy_msg))

connecting = connectProtocol(point, nats_protocol)
reactor.run()

When a message comes in for the subject “happy” on_happy_msg will be called.

Make a subject responder.

The only difference from a subscriber is that the on_msg function will publish a message to the reply_to subject of the message:

def respond_on_msg(nats_protocol, sid, subject, reply_to, payload):
    if reply_to:
        nats_protocol.pub(reply_to, "Roger, from {}!".format(responder_id))

…:

nats_protocol = txnats.io.NatsProtocol(
    verbose=False,
    on_connect=lambda np: np.sub("get-response", "6", on_msg=respond_on_msg))

For full context see respond.py

Distribute the responder load.

To distribute the load: subscribe with a queue-group and any message will go to one of the responders:

nats_protocol = txnats.io.NatsProtocol(
    verbose=False,
    on_connect=lambda np: np.sub("get-response", "6",
                                 queue_group="excelsior",
                                 on_msg=respond_on_msg))

However many processes you have subscribed to this subject and queue group will have the messages sent to only one of them. If there are four running, and 100 messages are sent on the “get-response” subject, each one should only have to respond to 25, distributing the work load.

For full context see queue_respond.py and something that will make a bunch of requests on that subject. make_requests.py

Release History

Release History

0.7.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
txnats-0.7.4.macosx-10.10-x86_64.exe (81.9 kB) Copy SHA256 Checksum SHA256 any Windows Installer Nov 19, 2016
txnats-0.7.4-py2.7.egg (36.5 kB) Copy SHA256 Checksum SHA256 2.7 Egg Nov 19, 2016
txnats-0.7.4-py3.5.egg (37.4 kB) Copy SHA256 Checksum SHA256 3.5 Egg Nov 19, 2016
txnats-0.7.4.tar.gz (15.5 kB) Copy SHA256 Checksum SHA256 Source Nov 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting