Skip to main content
|Travis|_ |Python27|_ |Python33|_ |Python34|_ |Python35|_ |Python36|_

.. |Travis| image:: https://travis-ci.org/noisyboiler/nameko-wamp.svg?branch=master
.. _Travis: https://travis-ci.org/noisyboiler/nameko-wamp

.. |Python27| image:: https://img.shields.io/badge/python-2.7-blue.svg
.. _Python27: https://pypi.python.org/pypi/nameko-wamp/

.. |Python34| image:: https://img.shields.io/badge/python-3.4-blue.svg
.. _Python34: https://pypi.python.org/pypi/nameko-wamp/

.. |Python35| image:: https://img.shields.io/badge/python-3.5-blue.svg
.. _Python35: https://pypi.python.org/pypi/nameko-wamp/

.. |Python36| image:: https://img.shields.io/badge/python-3.6-blue.svg
.. _Python36: https://pypi.python.org/pypi/nameko-wamp/

nameko wamp
===========

Web Application Messaging Protocol (WAMP) for the nameko microservices framework

Nameko Wamp provides Extensions for WAMP PUB-SUB and RPC. Here is a (silly) example service implementing WAMP entrypoints and dependencies.

::

from nameko_wamp.extensions.dependencies import Caller, Publisher
from nameko_wamp.extensions.entrypoints import consume, callee


class WeatherService:

name = "weather_service"

# a Dependency used to make remote procedure calls over WAMP.
# note that we don't need to know what nameko service implements
# a particular remote procedure.
caller = Caller()
# another Dependency to publish messages to Topics.
publihser = Publisher()

@callee
def get_weather(self):
# the weather is always sunny here!
return "sunny"

@consume
def weather_updates(self, topic_data):
# and do something with the new weather data here
pass


One method is marked as a "callee", which is a WAMP Role, and another is marked as a WAMP "caller" Role. The former is callable over RPC and is (almost) exactly the same as the nameko ``rpc`` Extension. The latter consumes from a WAMP Topic and appears exactly the same as the nameko ``event_handler`` Extension.

There is also the dependency injection ``caller``. Yet another WAMP Role, this allows outgoing RPC calls from your service to other nameko services. Finally the WAMP Role ``publisher`` dependency which allows a service API to publish messages to WAMP Topics.

Wampy
~~~~~

**Important**

Under the hood **nameko-wamp** uses wampy_ as the Client Peer. Wampy uses **Gevent** by default for async networking whilst nameko uses **Eventlet**, so you must instruct wampy to use *eventlet* too.

::

$ export WAMPY_ASYNC_NAME=eventlet

You can use a stand-alone **wampy** Client to interact with your nameko services too. See the wampy_ project for more details, but the standard pattern is:

::

with Client(url="ws://example.com:8080") as client:
result = client.rpc.get_weather()
assert result == "sunny"

# and publish to a Topic
client.publish(topic="foobar", message={...})

Note that when I call a remote procedure there is no reference to the service that provides it - and this is different to core nameko where a service name must be provided. This simpler behaviour is explained by the Router Peer which maintains all the registrations and subscriptions on behalf of WAMP clients implementing these Roles.


Run Tests
---------

::

$ pip install --editable .[dev]
$ py.test ./test -vs


.. _wampy: https://github.com/noisyboiler/wampy
.. _nameko: https://github.com/nameko/nameko


Metadata

Release files for nameko-wamp 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for nameko-wamp 0.3.0
File Interpreter ABI Platform Actions
nameko_wamp-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for nameko_wamp-0.3.0-py2.py3-none-any.whl

Release files / nameko_wamp-0.3.0-py2.py3-none-any.whl

Download URL nameko_wamp-0.3.0-py2.py3-none-any.whl
Size 22.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7be165170595a804d943fa3896d496e44ad1bd12cbb31ff3f04e962e13459bca
BLAKE2b-256 checksum
How to use checksums
e6b07d01366d6f24d61f2856f2343533c8400bfc7b2b4494dcc3b94b17a404b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Security for nameko-wamp 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page