Skip to main content

Travis Python27 Python33 Python34 Python35 Python36

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.

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


class WeatherService:

    name = "weather_service"

    caller = Caller()
    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

Under the hood nameko wamp uses wampy as the Client Peer - and the Router Peer when running tests. The Router is Crossbar.io.

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(router=router) 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

Release files for nameko-wamp 0.1.1

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.1.1
File Interpreter ABI Platform
nameko_wamp-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

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

Download URL nameko_wamp-0.1.1-py2.py3-none-any.whl
Size 9.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
dfc7dbb0941aeaad83a77cf0ef932e3899e2af91f04a5c14f4a4e0adcd1f7ff9
BLAKE2b-256 checksum
How to use checksums
dca26123fba71af420b460cdbf388f19a8ed4034e08f7aa80611baa4ffc9ddb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.3.0

1 release file

0.2.0

1 release file

This release

0.1.1 This release

1 release file

0.1.0

1 release file

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