doc/book/en/devrepo/repo/hooks.rst
branchstable
changeset 8981 26fddf8d65d0
parent 8670 f02139297beb
child 9184 b982e88e4836
equal deleted inserted replaced
8980:c0b82dbcf6a3 8981:26fddf8d65d0
   184       __regid__ = 'foo_startup'
   184       __regid__ = 'foo_startup'
   185 
   185 
   186       def __call__(self):
   186       def __call__(self):
   187           def callback(msg):
   187           def callback(msg):
   188               self.info('received message: %s', ' '.join(msg))
   188               self.info('received message: %s', ' '.join(msg))
   189           self.repo.app_instances_bus.subscribe('hello', callback)
   189           self.repo.app_instances_bus.add_subscription('hello', callback)
   190 
   190 
   191 .. sourcecode:: python
   191 .. sourcecode:: python
   192 
   192 
   193   def do_foo(self):
   193   def do_foo(self):
   194       actually_do_foo()
   194       actually_do_foo()
   195       self._cw.repo.app_instances_bus.publish(['hello', 'world'])
   195       self._cw.repo.app_instances_bus.publish(['hello', 'world'])
   196 
   196 
   197 The `zmq-address-pub` configuration variable contains the address used
   197 The `zmq-address-pub` configuration variable contains the address used
   198 by the instance for sending messages, e.g. `zmqpickle-tcp://*:1234`.  The
   198 by the instance for sending messages, e.g. `tcp://*:1234`.  The
   199 `zmq-address-sub` variable contains a comma-separated list of addresses
   199 `zmq-address-sub` variable contains a comma-separated list of addresses
   200 to listen on, e.g. `zmqpickle-tcp://localhost:1234, zmqpickle-tcp://192.168.1.1:2345`.
   200 to listen on, e.g. `tcp://localhost:1234, tcp://192.168.1.1:2345`.
   201 
   201 
   202 
   202 
   203 Hooks writing tips
   203 Hooks writing tips
   204 ------------------
   204 ------------------
   205 
   205