本文整理匯總了Python中kombu.mixins.ConsumerMixin方法的典型用法代碼示例。如果您正苦於以下問題:Python mixins.ConsumerMixin方法的具體用法?Python mixins.ConsumerMixin怎麽用?Python mixins.ConsumerMixin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kombu.mixins
的用法示例。
在下文中一共展示了mixins.ConsumerMixin方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_consumers
# 需要導入模塊: from kombu import mixins [as 別名]
# 或者: from kombu.mixins import ConsumerMixin [as 別名]
def get_consumers(self, Consumer, channel):
"""
Must be implemented for Kombu ConsumerMixin
"""
return [Consumer(queues=self.tasks.task_queues,
accept=['json'],
callbacks=[self.process_task])]
示例2: stop
# 需要導入模塊: from kombu import mixins [as 別名]
# 或者: from kombu.mixins import ConsumerMixin [as 別名]
def stop(self):
try:
self._updates_thread = concurrency.kill(self._updates_thread)
self._load_thread = concurrency.kill(self._load_thread)
finally:
self.connection.release()
# Note: We sleep after we consume a message so we give a chance to other
# green threads to run. If we don't do that, ConsumerMixin will block on
# waiting for a message on the queue.