Documentation for pulsar 0.9.2. For development docs, go here.

A Task Queue with a JSON-RPC Api

The code for this example is located in the examples.taskqueue.manage module.

This example creates two pulsar applications performing different duties. The first application is a distributed a task queue for processing tasks implemented in the examples.taskqueue.simpletasks module. The second application is a WSGI server which exposes the task queue functionalities via a JSON-RPC api.

To run the server type:

python manage.py

Open a new shell and launch python and type:

>>> from pulsar.apps import rpc
>>> p = rpc.JsonProxy('http://localhost:8060')
>>> p.ping()
'pong'
>>> p.calc.add(3,4)
7.0
>>>

Implementation

class examples.taskqueue.manage.RpcRoot(taskqueue, **kwargs)[source]

The JSONRPC handler which communicates with the task queue.

class examples.taskqueue.manage.server(name=None, description=None, epilog=None, version=None, argv=None, parse_console=True, script=None, cfg=None, load_config=True, **params)[source]

Build a multi-app consisting on a taskqueue and a JSON-RPC server.

This class shows how to use the MultiApp utility for starting several pulsar applications at once.



Table Of Contents

Previous topic

Websocket Chat Server

Next topic

Django with Pulsar

This Page