Python源码示例:zmq.green.PUB

示例1
def connect(self, context):
        if self.socket is not None:
            return

        self.context = context

        self.socket = context.socket(zmq.PUB)
        self.socket.bind('ipc:///var/run/minemeld/{}'.format(self.fanout))

        self.reply_socket = context.socket(zmq.REP)
        self.reply_socket.bind('ipc:///var/run/minemeld/{}:reply'.format(self.fanout)) 
示例2
def connect(self, context):
        if self.socket is not None:
            return

        self.context = context

        self.socket = context.socket(zmq.PUB)
        self.socket.bind('ipc:///var/run/minemeld/{}'.format(self.topic)) 
示例3
def on_start(self):
        self.sock = self.ctx.socket(zmq.PUB)
        if 'bind' in self.config:
            self.sock.bind(self.config['bind'])
        elif 'connect' in self.config:
            self.sock.connect(self.config['connect']) 
示例4
def __init__(self,
                 zmq_context,
                 zmq_proxy_xsub_url=ait.SERVER_DEFAULT_XSUB_URL,
                 zmq_proxy_xpub_url=ait.SERVER_DEFAULT_XPUB_URL,
                 **kwargs):

        self.context = zmq_context
        # open PUB socket & connect to broker
        self.pub = self.context.socket(zmq.PUB)
        self.pub.connect(zmq_proxy_xsub_url.replace('*', 'localhost'))

        # calls gevent.Greenlet or gs.DatagramServer __init__
        super(ZMQClient, self).__init__(**kwargs) 
示例5
def configure():
    # Get the list of transports to bind from settings. This allows us to PUB
    # messages to multiple announcers over a variety of socket types
    # (UNIX sockets and/or TCP sockets).
    for binding in Settings.GATEWAY_SENDER_BINDINGS:
        sender.bind(binding)

    for schemaRef, schemaFile in Settings.GATEWAY_JSON_SCHEMAS.iteritems():
        validator.addSchemaResource(schemaRef, resource_string('eddn.Gateway', schemaFile)) 
示例6
def passthrough(zmq_context=None):
    if zmq_context is None:
        zmq_context = zmq_ctx
    zmq_sock_pull = zmq_context.socket(zmq.PULL)
    zmq_sock_pull.bind(ZMQ_PASSTHROUGH_URL_PULL)

    zmq_sock_pub = zmq_context.socket(zmq.PUB)
    zmq_sock_pub.bind(ZMQ_PASSTHROUGH_URL_PUB)
    while True:
        zmq_sock_pub.send_string(zmq_sock_pull.recv())

# If being run as a seperate process: