Skip to main content

queue_declare

Declares a queue on the AMQP broker with specified persistence and deletion settings, ensuring a connection is active before execution. It outputs the queue status including message and consumer counts to the console and handles reconnection on failure.

def queue_declare(
amqp_context: object,
queue: string,
passive: boolean,
durable: boolean,
auto_delete: boolean
) - > null

Declares a queue on the AMQP broker, creating it if it does not exist or verifying its existence if the passive flag is set.

Parameters

NameTypeDescription
amqp_contextobjectThe context object containing the active AMQP channel and CLI configuration.
queuestringThe name of the queue to declare or verify.
passivebooleanIf true, the server will only check if the queue exists; if it does not, an error is raised.
durablebooleanIf true, the queue will survive broker restarts.
auto_deletebooleanIf true, the queue will be deleted automatically when all consumers have finished using it.

Returns

TypeDescription
nullThis function does not return a value but outputs the queue status (message and consumer counts) to the console.