# HG changeset patch # User Thierry Florac # Date 1547135971 -3600 # Node ID 6bcc3d05459eb6cf6eaa22d04560359324cef9ef # Parent 3fc37f238cff1565097cb472128720be384d3dc2 Added ZMS process started event diff -r 3fc37f238cff -r 6bcc3d05459e src/pyams_zmq/interfaces.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_zmq/interfaces.py Thu Jan 10 16:59:31 2019 +0100 @@ -0,0 +1,52 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + +from zope.interface import Attribute, Interface, implementer +from zope.interface.interfaces import IObjectEvent, ObjectEvent + + +class IZMQProcess(Interface): + """ZeroMQ process interface""" + + socket_type = Attribute("Socket type") + + def setup(self): + """Initialize process context and events loop and initialize stream""" + + def stream(self, sock_type, addr, bind, callback=None, subscribe=b''): + """Create ZMQStream""" + + def init_stream(self): + """initialize response stream""" + + def start(self): + """Start the process""" + + def stop(self): + """Stop the process""" + + +class IZMQProcessStartedEvent(IObjectEvent): + """ZMQ process started event interface""" + + +@implementer(IZMQProcessStartedEvent) +class ZMQProcessStartedEvent(ObjectEvent): + """ZMQ process started event""" + + +class IZMQMessageHandler(Interface): + """ZeroMQ message handler""" + + handler = Attribute("Concrete message handler") diff -r 3fc37f238cff -r 6bcc3d05459e src/pyams_zmq/interfaces/__init__.py --- a/src/pyams_zmq/interfaces/__init__.py Fri Oct 26 09:59:34 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -# -# Copyright (c) 2008-2015 Thierry Florac -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# - -__docformat__ = 'restructuredtext' - -# import standard library - -# import interfaces -from zope.interface import Interface, Attribute - -# import packages - - -class IZMQProcess(Interface): - """ZeroMQ process interface""" - - socket_type = Attribute("Socket type") - - def setup(self): - """Initialize process context and events loop and initialize stream""" - - def stream(self, sock_type, addr, bind, callback=None, subscribe=b''): - """Create ZMQStream""" - - def init_stream(self): - """initialize response stream""" - - def start(self): - """Start the process""" - - def stop(self): - """Stop the process""" - - -class IZMQMessageHandler(Interface): - """ZeroMQ message handler""" - - handler = Attribute("Concrete message handler")