Skip to main content

ConsumerStep

Bootstep that starts a message consumer.

Attributes

AttributeTypeDescription
requirestuple = ('celery.worker.consumer:Connection',)A tuple containing the dependencies required by this step, specifically the connection component.
consumerslist = nullA list of message consumer instances that are currently active or to be started by this step.

Constructor

Signature

def ConsumerStep()

Methods


get_consumers()

@classmethod
def get_consumers(
channel: kombu.Connection.channel
) - > Iterable[kombu.Consumer]

Fetches the list of message consumer instances to be started by this bootstep. Subclasses must implement this to define which queues and exchanges to consume from.

Parameters

NameTypeDescription
channelkombu.Connection.channelThe AMQP channel used to create and configure the consumer instances

Returns

TypeDescription
Iterable[kombu.Consumer]A collection of consumer objects configured to use the provided channel

start()

@classmethod
def start(
c: celery.worker.consumer.Consumer
) - > null

Initializes the message consumers by opening a new channel and invoking the consume method on each consumer instance.

Parameters

NameTypeDescription
ccelery.worker.consumer.ConsumerThe parent consumer controller providing the connection context

Returns

TypeDescription
null

stop()

@classmethod
def stop(
c: celery.worker.consumer.Consumer
) - > null

Stops the consumers and closes their associated channels, ensuring that active consumption is cancelled.

Parameters

NameTypeDescription
ccelery.worker.consumer.ConsumerThe parent consumer controller providing the connection context

Returns

TypeDescription
null

shutdown()

@classmethod
def shutdown(
c: celery.worker.consumer.Consumer
) - > null

Shuts down the consumers and closes channels without explicitly sending a cancellation command to the broker.

Parameters

NameTypeDescription
ccelery.worker.consumer.ConsumerThe parent consumer controller providing the connection context

Returns

TypeDescription
null