DeleteExchange Method

Deletes an exchange.

Syntax

ANSI (Cross Platform)
int DeleteExchange(const char* lpszChannelName, const char* lpszExchangeName, int bIfUnused, int bNoWait);

Unicode (Windows)
INT DeleteExchange(LPCWSTR lpszChannelName, LPCWSTR lpszExchangeName, BOOL bIfUnused, BOOL bNoWait);
- (void)deleteExchange:(NSString*)channelName :(NSString*)exchangeName :(BOOL)ifUnused :(BOOL)noWait;
#define MID_AMQPCLASSIC_DELETEEXCHANGE 12

IPWORKSIOT_EXTERNAL int IPWORKSIOT_CALL IPWorksIoT_AMQPClassic_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method is used to delete an exchange.

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.

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, and must not begin with amq..

When IfUnused is True, the server will only delete the exchange if no queues are bound to it.

The NoWait parameter, if True, will cause the server to execute the request asynchronously. For asynchronous request handling, the server only sends back a response in case of an error.

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

  • The value passed for ExchangeName fails one or more of the constraints described above.
  • No exchange named ExchangeName exists. (This does not apply for RabbitMQ; attempting to delete a non-existent exchange will always succeed.)
  • The IfUnused parameter was True, but the exchange still had one or more queues bound to it.

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 (C++)

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 IoT 2020 C++ Edition - Version 20.0 [Build 8265]