本文整理汇总了Python中celery.worker.consumer.Consumer.heart方法的典型用法代码示例。如果您正苦于以下问题:Python Consumer.heart方法的具体用法?Python Consumer.heart怎么用?Python Consumer.heart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.worker.consumer.Consumer
的用法示例。
在下文中一共展示了Consumer.heart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LoopConsumer
# 需要导入模块: from celery.worker.consumer import Consumer [as 别名]
# 或者: from celery.worker.consumer.Consumer import heart [as 别名]
def LoopConsumer(self, buffer=None, controller=None, timer=None, app=None,
without_mingle=True, without_gossip=True,
without_heartbeat=True, **kwargs):
if controller is None:
controller = Mock(name='.controller')
buffer = buffer if buffer is not None else self.buffer.put
timer = timer if timer is not None else self.timer
app = app if app is not None else self.app
c = Consumer(
buffer,
timer=timer,
app=app,
controller=controller,
without_mingle=without_mingle,
without_gossip=without_gossip,
without_heartbeat=without_heartbeat,
**kwargs
)
c.task_consumer = Mock(name='.task_consumer')
c.qos = QoS(c.task_consumer.qos, 10)
c.connection = Mock(name='.connection')
c.controller = c.app.WorkController()
c.heart = Mock(name='.heart')
c.controller.consumer = c
c.pool = c.controller.pool = Mock(name='.controller.pool')
c.node = Mock(name='.node')
c.event_dispatcher = mock_event_dispatcher()
return c