# HG changeset patch # User David Douard # Date 1354634168 -3600 # Node ID 52f576a7394c6ed8175d1f3dbb5882c841bedc74 # Parent 9d792e9f1c7942c26c8955f58781048943fb5d33 [zmq] add an introductive docstring on ZMQComm diff -r 9d792e9f1c79 -r 52f576a7394c server/cwzmq.py --- a/server/cwzmq.py Tue Dec 11 16:14:57 2012 +0100 +++ b/server/cwzmq.py Tue Dec 04 16:16:08 2012 +0100 @@ -32,6 +32,23 @@ ctx = zmq.Context() class ZMQComm(object): + """ + A simple ZMQ-based notification bus. + + There should at most one instance of this class attached to a + Repository. A typical usage may be something like:: + + def callback(msg): + self.info('received message: %s', ' '.join(msg)) + repo.app_instances_bus.subscribe('hello', callback) + + to subsribe to the 'hello' kind of message. On the other side, to + emit a notification, call:: + + repo.app_instances_bus.publish(['hello', 'world']) + + See http://docs.cubicweb.org for more details. + """ def __init__(self): self.ioloop = ioloop.IOLoop() self._topics = {}