Skip to main content

exchange_delete

Deletes a specified exchange from the AMQP broker, optionally checking if it is currently unused. This function requires an active channel connection and will attempt to reconnect if the connection is missing or an error occurs during the deletion process.

def exchange_delete(
amqp_context: object,
exchange: string,
if_unused: boolean
) - > null

Deletes an existing exchange from the AMQP broker to stop it from routing messages.

Parameters

NameTypeDescription
amqp_contextobjectThe application context containing the active AMQP channel and connection state.
exchangestringThe name of the exchange to be removed from the broker.
if_unusedbooleanIf true, the exchange will only be deleted if it has no active bindings.

Returns

TypeDescription
nullNothing is returned; the function outputs success or error messages to the console via the context object.