本文整理匯總了Python中zmq.green.PUB屬性的典型用法代碼示例。如果您正苦於以下問題:Python green.PUB屬性的具體用法?Python green.PUB怎麽用?Python green.PUB使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類zmq.green
的用法示例。
在下文中一共展示了green.PUB屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: connect
# 需要導入模塊: from zmq import green [as 別名]
# 或者: from zmq.green import PUB [as 別名]
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: on_start
# 需要導入模塊: from zmq import green [as 別名]
# 或者: from zmq.green import PUB [as 別名]
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'])
示例3: __init__
# 需要導入模塊: from zmq import green [as 別名]
# 或者: from zmq.green import PUB [as 別名]
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)
示例4: configure
# 需要導入模塊: from zmq import green [as 別名]
# 或者: from zmq.green import PUB [as 別名]
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))
示例5: passthrough
# 需要導入模塊: from zmq import green [as 別名]
# 或者: from zmq.green import PUB [as 別名]
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: