ConsumerStep
Bootstep that starts a message consumer.
Attributes
| Attribute | Type | Description |
|---|---|---|
| requires | tuple = ('celery.worker.consumer:Connection',) | A tuple containing the dependencies required by this step, specifically the connection component. |
| consumers | list = null | A 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
| Name | Type | Description |
|---|---|---|
| channel | kombu.Connection.channel | The AMQP channel used to create and configure the consumer instances |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| c | celery.worker.consumer.Consumer | The parent consumer controller providing the connection context |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| c | celery.worker.consumer.Consumer | The parent consumer controller providing the connection context |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| c | celery.worker.consumer.Consumer | The parent consumer controller providing the connection context |
Returns
| Type | Description |
|---|---|
null |