當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。