LrSqsClient.purgeQueue
Deletes all messages from the queue.
public static void purgeQueue()
Return values
The function does not return any values.
General information
This function empties the message queue. Emptying the queue might take some time, depending on the queue length, but not more than 60 seconds. Only one purge is permitted per minute.
If the queue is empty, a null object is received on receive message APIs.
Example
public void checkPurge(){
LrSqsClient.initClient(region, standardQueueUrl);
LrSqsClient.initMessageBatch();
LrSqsClient.addMessageToBatch("m1");
LrSqsClient.addMessageToBatch("m2");
LrSqsClient.addMessageToBatch("m3");
LrSqsClient.addMessageToBatch("m4");
LrSqsClient.sendMessageBatch();
LrSqsMessage message1 = LrSqsClient.receiveMessage();
LrSqsClient.purgeQueue();
message1 = LrSqsClient.receiveMessage();
if (message1 == null){
lr.output_message("we got null after purge -> ok");
}
else {
lr.error_message("we do not get null after purge!");
}
LrSqsClient.closeClient();
}