This document describes the current stable version of Celery (4.4). For development docs, go here.
celery.worker.consumer.consumer
¶
Worker Consumer Blueprint.
This module contains the components responsible for consuming messages from the broker, processing the messages and keeping the broker connections up and running.
-
class
celery.worker.consumer.consumer.
Consumer
(on_task_request, init_callback=<function noop>, hostname=None, pool=None, app=None, timer=None, controller=None, hub=None, amqheartbeat=None, worker_options=None, disable_rate_limits=False, initial_prefetch_count=2, prefetch_multiplier=1, **kwargs)[source]¶ Consumer blueprint.
-
class
Blueprint
(steps=None, name=None, on_start=None, on_close=None, on_stopped=None)[source]¶ Consumer blueprint.
-
default_steps
= ['celery.worker.consumer.connection:Connection', 'celery.worker.consumer.mingle:Mingle', 'celery.worker.consumer.events:Events', 'celery.worker.consumer.gossip:Gossip', 'celery.worker.consumer.heart:Heart', 'celery.worker.consumer.control:Control', 'celery.worker.consumer.tasks:Tasks', 'celery.worker.consumer.consumer:Evloop', 'celery.worker.consumer.agent:Agent']¶
-
name
= 'Consumer'¶
-
-
Strategies
¶ alias of
builtins.dict
-
connect
()[source]¶ Establish the broker connection used for consuming tasks.
Retries establishing the connection if the
broker_connection_retry
setting is enabled
-
init_callback
= None¶ Optional callback called the first time the worker is ready to receive tasks.
-
on_decode_error
(message, exc)[source]¶ Callback called if an error occurs while decoding a message.
Simply logs the error and acknowledges the message so it doesn’t enter a loop.
- Parameters
message (kombu.Message) – The message received.
exc (Exception) – The exception being handled.
-
pool
= None¶ The current worker pool instance.
-
restart_count
= -1¶
-
timer
= None¶ A timer used for high-priority internal tasks, such as sending heartbeats.
-
class