Share this page

# LrSqsClient.changeMessageVisibilityBatch

Sends the request of visibility change for all messages in the designated container.

`public static LrSqsChangeVisibilityBatchRequestStatus changeMessageVisibilityBatch()`

## Return values

This function returns a value of type LrSqsChangeVisibilityBatchRequestStatus. For details, see LrSqsChangeVisibilityBatchRequestStatus.

## General information

This method fails if the container does not contain any messages or receipt handles.

The batch can hold any number of messages. Upon calling the changeMessageVisibilityBatch() function, the batch is split into smaller collections, of at most 10 messages each, and each such collection is sent in a separate request.

## Example

Copy code

    public void changeVisibility() {

            LrSqsClient.initClient(region, standardQueueUrl);

            LrSqsClient.initMessageBatch();
            LrSqsClient.addMessageToBatch("m1");
            LrSqsClient.addMessageToBatch("m2");
            LrSqsClient.addMessageToBatch("m3");
            LrSqsClient.addMessageToBatch("m4");
            LrSqsClient.sendMessageBatch();

            LrSqsMessage message1 = LrSqsClient.receiveMessage();
            if (message1 != null){
                LrSqsClient.changeMessageVisibility(message1.receiptHandle(), 20);
            }
            List <LrSqsMessage> receivedMessages = LrSqsClient.receiveMessages(3, 20);

            LrSqsClient.initChangeMessageVisibilityBatch();
            int visibilityTimeout = 10;
            for (LrSqsMessage m : receivedMessages) {
                //LrSqsClient.addMessageToChangeVisibilityBatch(m, visibilityTimeout);
                LrSqsClient.addReceiptHandleToChangeVisibilityBatch(m.receiptHandle(), visibilityTimeout);
                visibilityTimeout += 2;
            }
            LrSqsClient.changeMessageVisibilityBatch();

            LrSqsClient.closeClient();
        }

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