Share this page

# LrSqsDeleteMessageBatchRequestStatus.failed

Returns one LrSqsDeleteMessageBatchStatusEntry element for each of the LrSqsMessages that were not deleted successfully.

`public Collection<LrSqsBatchErrorResultEntry> failed()`

## Return values

This function returns a collection of LrSqsDeleteMessageBatchStatusEntry objects. Each LrSqsMessage that was not deleted successfully using the deleteMessageBatch API has a corresponding LrSqsBatchErrorResultEntry object in this collection.

## Example

Copy code

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

            List<LrSqsMessage> collection = LrSqsClient.receiveMessages(5, 20);
            LrSqsDeleteMessageBatchRequestStatus status = LrSqsClient.deleteMessageBatch(collection);
            if (status.hasSuccessful()) {
                Collection<LrSqsDeleteMessageBatchStatusEntry> succ_res = status.successful();

                for (LrSqsDeleteMessageBatchStatusEntry 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: