Source code for zircon.subscribers.base

"""

"""

from abc import ABCMeta, abstractmethod


[docs]class BaseSubscriber(): """ Abstract base class defining the Subscriber interface. A Subscriber receives data from a Publisher. It is used by Injectors to listen to Reporters. **Usage**:: s = MySubscriber() s.open() while not done: msg = s.receive() process(msg) p.close() """ __metaclass__ = ABCMeta @abstractmethod
[docs] def open(self): """ Open the connection. """ raise NotImplementedError()
@abstractmethod
[docs] def close(self): """ Close the connection. """ raise NotImplementedError()
@abstractmethod
[docs] def receive(self): """ Receive a message. """ raise NotImplementedError()