Share this page

# LrSqsClient.initChangeMessageVisibilityBatch

Initializes the container for a ChangeMessageVisibilityBatch request.

`public static void initChangeMessageVisibilityBatch()`

## Return values

This function does not return any values.

## General information

This function initializes the container in which to store messages whose visibility needs to be changed.

After this function call the container is empty. Any messages left there are deleted.

## 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-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: