本文整理汇总了Python中mo_threads.Thread.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Thread.__init__方法的具体用法?Python Thread.__init__怎么用?Python Thread.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mo_threads.Thread
的用法示例。
在下文中一共展示了Thread.__init__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mo_threads import Thread [as 别名]
# 或者: from mo_threads.Thread import __init__ [as 别名]
def __init__(
self,
exchange, # name of the Pulse exchange
topic, # message name pattern to subscribe to ('#' is wildcard)
target=None, # WILL BE CALLED WITH PULSE PAYLOADS AND ack() IF COMPLETE$ED WITHOUT EXCEPTION
target_queue=None, # (aka self.queue) WILL BE FILLED WITH PULSE PAYLOADS
host='pulse.mozilla.org', # url to connect,
port=5671, # tcp port
user=None,
password=None,
vhost="/",
start=0, # USED AS STARTING POINT FOR ASSIGNING THE _meta.count ATTRIBUTE
ssl=True,
applabel=None,
heartbeat=False, # True to also get the Pulse heartbeat message
durable=False, # True to keep queue after shutdown
serializer='json',
broker_timezone='GMT',
kwargs=None
):
global count
count = coalesce(start, 0)
self.target_queue = target_queue
self.pulse_target = target
if (target_queue == None and target == None) or (target_queue != None and target != None):
Log.error("Expecting a queue (for fast digesters) or a target (for slow digesters)")
Thread.__init__(self, name="Pulse consumer for " + kwargs.exchange, target=self._worker)
self.settings = kwargs
kwargs.callback = self._got_result
kwargs.user = coalesce(kwargs.user, kwargs.username)
kwargs.applabel = coalesce(kwargs.applable, kwargs.queue, kwargs.queue_name)
kwargs.topic = topic
self.pulse = ModifiedGenericConsumer(kwargs, connect=True, **kwargs)
self.start()