UnbindQueue Method

Removes a previously-created queue binding.

Syntax

int UnbindQueue(const QString& qsChannelName, const QString& qsQueueName, const QString& qsExchangeName, const QString& qsRoutingKey);

Remarks

This method removes a previously-created queue binding.

ChannelName controls what channel the class will send the request over. While any channel can technically be used, keep in mind that the server will close it if a channel error occurs. For this reason, it is good practice to make requests such as this one using a channel that is not involved in message publishing or consumption.

QueueName must be a non-empty string consisting only of letters, digits, hyphens, underscores, periods, and colons. It must be no longer than 255 characters.

The server's default exchange may be specified by passing empty string for ExchangeName. Otherwise, ExchangeName must be a non-empty string consisting only of letters, digits, hyphens, underscores, periods, and colons. It must be no longer than 255 characters.

RoutingKey should be the same routing key used when originally creating the binding that is to be removed. For bindings created using arguments instead of a routing key, the Argument* properties must contain the same items used originally instead.

An exception is thrown if no channel with the given ChannelName exists, or if the server returns an error because:

  • No queue with the given QueueName exists. (Does not apply to RabbitMQ.)
  • No exchange with the given ExchangeName exists. (Does not apply to RabbitMQ.)

Note that in AMQP, server errors are grouped into "connection errors" and "channel errors", and both are fatal. That is, if the server returns a channel error, it will then close the channel which caused the error; and if it returns a connection error, it will then close the connection. The AMQPClassic class's Error Codes page includes AMQP's various connection and channel errors.

Error Handling

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks MQ 2020 Qt Edition - Version 20.0 [Build 8155]