本文整理汇总了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: