예제 #1
0
class MonaCallback0MQ(object):
    """
    My BlueSky 0MQ talker to send *all* documents emitted
    """
    def __init__(self,
                 host=None,
                 port=None,
                 detector=None,
                 signal_name=None,
                 rotation_name=None):
        self.talker = ZMQ_Pair(host or "localhost", port or "5556")
        self.detector = detector
        self.signal_name = signal_name
        self.rotation_name = rotation_name

    def end(self):
        """ZMQ client tells the server to end the connection"""
        self.talker.end()

    def receiver(self, key, document):
        """receive from RunEngine, send from 0MQ talker"""
        print("MonaCallback0MQ.receiver()", key)
        mona_zmq_sender(self.talker,
                        key,
                        document,
                        self.detector,
                        signal_name=self.signal_name,
                        rotation_name=self.rotation_name)
예제 #2
0
 def __init__(self,
              host=None,
              port=None,
              detector=None,
              signal_name=None,
              rotation_name=None):
     self.talker = ZMQ_Pair(host or "localhost", port or "5556")
     self.detector = detector
     self.signal_name = signal_name
     self.rotation_name = rotation_name