Share this page

# LrSqsChangeVisibilityBatchRequestStatus.hasSuccessful

Returns whether any LrSqsMessage updated its visibility timeout successfully.

`public boolean hasSuccessful()`

## Return values

This function returns a Boolean value that represents whether any LrSqsMessage updated its visibility timeout successfully using the changeMessageVisibilityBatch API.

## Example

Copy code

    public int action() throws Throwable {
            LrSqsClient.initClient(region, standardQueueUrl);

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

            List <LrSqsMessage> receivedMessages = LrSqsClient.receiveMessages(3, 20);

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

            LrSqsChangeVisibilityBatchRequestStatus status = LrSqsClient.changeMessageVisibilityBatch();
            if (status.hasSuccessful()) {
                Collection<LrSqsChangeVisibilityBatchStatusEntry> succ_res = status.successful();

                for (LrSqsChangeVisibilityBatchStatusEntry entry : succ_res){
                    lr.output_message("Message id within batch: " + entry.id());
                }
            }
            if (status.hasFailed()){
                lr.output_message("Failed to delete: " + status.failed().size());
            }
            LrSqsClient.closeClient();

            return 0;
        }

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: