PurgeQueue Method

Purges all messages from a queue.

Syntax

public func purgeQueue(channelName: String, queueName: String, noWait: Bool) throws -> Void

Remarks

This method purges all messages from the queue named QueueName. Messages which have been sent but are awaiting acknowledgement are not affected.

After each successful call to this method, the class populates the QueueMessageCount property with the number of messages purged from the queue. (Note that this does not occur if the NoWait parameter is set to True.)

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 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 no queue named QueueName exists.

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.

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