Skip to main content

Pidbox

Worker mailbox.

Attributes​

AttributeTypeDescription
consumerkombu.Consumer = NoneThe AMQP consumer instance used to listen for and process incoming control commands.

Constructor​

Signature​

def Pidbox(
c: Any
) - > null

Parameters​

NameTypeDescription
cAnyThe 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​

NameTypeDescription
bodydictThe decoded message content containing the control command and arguments.
messagekombu.MessageThe raw message object received from the transport layer.

Returns​

TypeDescription
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​

NameTypeDescription
c[Consumer](../consumer/consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)The parent consumer instance providing the connection and error handling context.

Returns​

TypeDescription
null

on_stop()​

@classmethod
def on_stop() - > null

Provides a hook for performing cleanup actions when the mailbox is stopping.

Returns​

TypeDescription
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​

NameTypeDescription
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​

TypeDescription
null

reset()​

@classmethod
def reset() - > null

Restarts the mailbox by stopping the current consumer and re-initializing the connection and listener.

Returns​

TypeDescription
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​

NameTypeDescription
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​

TypeDescription
null