Pidbox
Worker mailbox.
Attributes
| Attribute | Type | Description |
|---|---|---|
| consumer | kombu.Consumer = None | The AMQP consumer instance used to listen for and process incoming control commands. |
Constructor
Signature
def Pidbox(
c: Any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| c | Any | The consumer or controller instance used to provide hostname, app context, and event loop configuration. |
Methods
on_message()
@classmethod
def on_message(
body: dict,
message: kombu.Message
) - > null
Processes incoming control messages by advancing the logical clock and dispatching the message body to the node handler. It handles command errors and resets the mailbox state if a critical exception occurs.
Parameters
| Name | Type | Description |
|---|---|---|
| body | dict | The decoded message content containing the control command and arguments. |
| message | kombu.Message | The raw message object received from the transport layer. |
Returns
| Type | Description |
|---|---|
null |
start()
@classmethod
def start(
c: [Consumer](../consumer/consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null
Initializes the mailbox by opening a new communication channel and starting the consumer to listen for control commands.
Parameters
| Name | Type | Description |
|---|---|---|
| c | [Consumer](../consumer/consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer) | The parent consumer instance providing the connection and error handling context. |
Returns
| Type | Description |
|---|---|
null |
on_stop()
@classmethod
def on_stop() - > null
Provides a hook for performing cleanup actions when the mailbox is stopping.
Returns
| Type | Description |
|---|---|
null |
stop()
@classmethod
def stop(
c: [Consumer](../consumer/consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null
Stops the mailbox consumer and closes the underlying communication channel to release resources.
Parameters
| Name | Type | Description |
|---|---|---|
| c | [Consumer](../consumer/consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer) | The parent consumer instance used to safely ignore errors during channel closure. |
Returns
| Type | Description |
|---|---|
null |
reset()
@classmethod
def reset() - > null
Restarts the mailbox by stopping the current consumer and re-initializing the connection and listener.
Returns
| Type | Description |
|---|---|
null |
shutdown()
@classmethod
def shutdown(
c: [Consumer](../consumer/consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null
Gracefully shuts down the mailbox by canceling the broadcast consumer and closing all associated channels.
Parameters
| Name | Type | Description |
|---|---|---|
| c | [Consumer](../consumer/consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer) | The parent consumer instance used to manage the cancellation and closure process. |
Returns
| Type | Description |
|---|---|
null |