LrSqsChangeVisibilityBatchRequestStatus.failed
Returns one LrSqsChangeVisibilityBatchStatusEntry element for each LrSqsMessage that did not update its visibility timeout successfully.
public Collection<LrSqsBatchErrorResultEntry> failed()
Return values
This function returns a collection of LrSqsBatchErrorResultEntry objects. Each LrSqsMessage that did not update its visibility timeout successfully using the changeMessageVisibilityBatch API has a corresponding LrSqsBatchErrorResultEntry object in this collection.
Example
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;
}