SetChannelAccept Method

Disables or enables message acceptance for a given channel.

Syntax

int SetChannelAccept(const QString& qsChannelName, bool bAccept);

Remarks

This method is used to disable and enable message acceptance for the channel specified by ChannelName.

A channel is always configured to accept messages when first created, allowing the server to freely deliver messages to the class for any consumers that have been created on that channel using the Consume method.

Disabling message acceptance for a channel prevents the server from automatically delivering messages to the class over it; however, it is still possible to use the FetchMessage method to synchronously attempt to retrieve a message on a channel with message acceptance disabled.

An exception is thrown if no channel with the given ChannelName exists, or (for RabbitMQ only) if the server returns an error because Accept was False. (RabbitMQ does not support disabling message acceptance.)

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