Notify event when ZMS process is started
authorThierry Florac <thierry.florac@onf.fr>
Thu, 10 Jan 2019 17:00:00 +0100
changeset 22 05aaf0acf4fb
parent 21 6bcc3d05459e
child 23 99fb7f5fe348
Notify event when ZMS process is started
src/pyams_zmq/process.py
--- a/src/pyams_zmq/process.py	Thu Jan 10 16:59:31 2019 +0100
+++ b/src/pyams_zmq/process.py	Thu Jan 10 17:00:00 2019 +0100
@@ -12,21 +12,18 @@
 
 __docformat__ = 'restructuredtext'
 
-
-# import standard library
 import multiprocessing
 import signal
 import sys
+
 import zmq
-
-# import interfaces
-from pyams_zmq.interfaces import IZMQProcess
-
-# import packages
 from zmq.auth.thread import ThreadAuthenticator
 from zmq.eventloop import ioloop, zmqstream
 from zope.interface import implementer
 
+from pyams_utils.registry import get_global_registry
+from pyams_zmq.interfaces import IZMQProcess, ZMQProcessStartedEvent
+
 
 @implementer(IZMQProcess)
 class ZMQProcess(multiprocessing.Process):
@@ -75,6 +72,8 @@
         """Sets up everything and starts the event loop."""
         signal.signal(signal.SIGTERM, self.exit)
         self.setup()
+        registry = get_global_registry()
+        registry.notify(ZMQProcessStartedEvent(self))
         self.loop.start()
 
     def stop(self):