当前位置: 首页>>代码示例>>Python>>正文


Python Thread.__init__方法代码示例

本文整理汇总了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()
开发者ID:rv404674,项目名称:TUID,代码行数:39,代码来源:pulse.py


注:本文中的mo_threads.Thread.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。