本文整理汇总了Python中pyon.net.endpoint.Subscriber.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Subscriber.__init__方法的具体用法?Python Subscriber.__init__怎么用?Python Subscriber.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.net.endpoint.Subscriber
的用法示例。
在下文中一共展示了Subscriber.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import __init__ [as 别名]
def __init__(self, xp_name=None, event_type=None, origin=None, queue_name=None, callback=None,
sub_type=None, origin_type=None, pattern=None, auto_delete=None, *args, **kwargs):
"""
Initializer.
If the queue_name is specified here, the sysname is prefixed automatically to it. This is because
named queues are not namespaces to their exchanges, so two different systems on the same broker
can cross-pollute messages if a named queue is used.
Note: an EventSubscriber needs to be closed to free broker resources
"""
self._cbthread = None
# sets self._ev_recv_name, self.binding
BaseEventSubscriberMixin.__init__(self, xp_name=xp_name, event_type=event_type, origin=origin,
queue_name=queue_name, sub_type=sub_type, origin_type=origin_type,
pattern=pattern, auto_delete=auto_delete)
log.debug("EventPublisher events pattern %s", self.binding)
from_name = self._get_from_name()
binding = self._get_binding()
Subscriber.__init__(self, from_name=from_name, binding=binding, callback=callback,
auto_delete=self._auto_delete, **kwargs)
示例2: __init__
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import __init__ [as 别名]
def __init__(self, callback=None, pattern='#', *args, **kwargs):
"""
Note: a ConversationSubscriber needs to be closed to free broker resources
"""
self._cbthread = None
self.binding = pattern
log.debug("ConversationSubscriber pattern %s", self.binding)
Subscriber.__init__(self, binding=self.binding, callback=callback, **kwargs)
示例3: __init__
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import __init__ [as 别名]
def __init__(self, xp_name=None, event_name=None, origin=None, queue_name=None, callback=None, *args, **kwargs):
"""
Initializer.
If the queue_name is specified here, the sysname is prefixed automatically to it. This is becuase
named queues are not namespaces to their exchanges, so two different systems on the same broker
can cross-pollute messages if a named queue is used.
"""
self._event_name = event_name or self.event_name
xp_name = xp_name or get_events_exchange_point()
binding = self._topic(origin)
# prefix the queue_name, if specified, with the sysname
# this is because queue names transcend xp boundaries (see R1 OOIION-477)
if queue_name is not None:
if not queue_name.startswith(bootstrap.sys_name):
queue_name = "%s.%s" % (bootstrap.sys_name, queue_name)
log.warn("queue_name specified, prepending sys_name to it: %s" % queue_name)
name = (xp_name, queue_name)
Subscriber.__init__(self, name=name, binding=binding, callback=callback, **kwargs)
示例4: __init__
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import __init__ [as 别名]
def __init__(self, xp_name=None, event_type=None, origin=None, queue_name=None, callback=None,
sub_type=None, origin_type=None, *args, **kwargs):
"""
Initializer.
If the queue_name is specified here, the sysname is prefixed automatically to it. This is because
named queues are not namespaces to their exchanges, so two different systems on the same broker
can cross-pollute messages if a named queue is used.
Note: an EventSubscriber needs to be closed to free broker resources
"""
self.callback = callback
self._cbthread = None
self.event_type = event_type
self.sub_type = sub_type
self.origin_type = origin_type
self.origin = origin
xp_name = xp_name or get_events_exchange_point()
binding = self._topic(event_type, origin, sub_type, origin_type)
self.binding = binding
# TODO: Provide a case where we can have multiple bindings (e.g. different event_types)
# prefix the queue_name, if specified, with the sysname
# this is because queue names transcend xp boundaries (see R1 OOIION-477)
if queue_name is not None:
if not queue_name.startswith(bootstrap.get_sys_name()):
queue_name = "%s.%s" % (bootstrap.get_sys_name(), queue_name)
log.warn("queue_name specified, prepending sys_name to it: %s" % queue_name)
name = (xp_name, queue_name)
log.debug("EventPublisher events pattern %s", binding)
Subscriber.__init__(self, from_name=name, binding=binding, callback=self._callback, **kwargs)
示例5: __init__
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import __init__ [as 别名]
def __init__(self, process=None, **kwargs):
self._process = process
Subscriber.__init__(self, **kwargs)
示例6: __init__
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import __init__ [as 别名]
def __init__(self, process=None, routing_call=None, **kwargs):
assert process
self._process = process
self._routing_call = routing_call
Subscriber.__init__(self, **kwargs)
示例7: __init__
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import __init__ [as 别名]
def __init__(self, queue_name, callback, **kwargs):
self.callback = callback
Subscriber.__init__(self, from_name=queue_name, callback=callback,
**kwargs)