Skip to content

nanoservice is a small Python library for writing lightweight networked services using nanomsg

License

Notifications You must be signed in to change notification settings

walkr/nanoservice

Repository files navigation

nanoservice

nanoservice is a small Python library for writing lightweight networked services using nanomsg

With nanoservice you can break up monolithic applications into small, specialized services which communicate with each other.

Build Status

Install

  1. Make sure you have the nanomsg library installed:
$ git clone [email protected]:nanomsg/nanomsg.git
$ ./configure
$ make
$ make check
$ sudo make install

For more details visit the official nanomsg repo

On OS X you can also do:

$ brew install nanomsg
  1. Install nanoservice:

From project directory

$ make install

Or via pip

$ pip install nanoservice (it's broken)

Example Usage

The service:

from nanoservice import Responder

def echo(msg):
    return msg

s = Responder('ipc:///tmp/service.sock')
s.register('echo', echo)
s.start()
$ python echo_service.py

The client:

from nanoservice import Requester

c = Requester('ipc:///tmp/service.sock')
res, err = c.call('echo', 'hello world’)
print('Result is {}'.format(res))
$ python my_client.py
$ Result is: hello world

Other

To run tests:

$ make test

To run benchmarks

$ make bench

Check out examples directory for more examples.

MIT Licensed

About

nanoservice is a small Python library for writing lightweight networked services using nanomsg

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published