Share this page

# 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

Copy code

    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();
        }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: