Share this page

# LrSqsChangeVisibilityBatchRequestStatus.successful

Returns one LrSqsChangeVisibilityBatchStatusEntry element for each LrSqsMessage that changed its visibility timeout successfully.

`public Collection< LrSqsChangeVisibilityBatchStatusEntry> successful()`

## Return values

This function returns a collection of LrSqsChangeVisibilityBatchStatusEntry objects. Each LrSqsMessage that changed its visibility timeout successfully using the changeMessageVisibilityBatch API has a corresponding LrSqsChangeVisibilityBatchStatusEntry object in this collection.

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