LrSqsChangeVisibilityBatchStatusEntry.id
Returns the ID within the batch of the LrSqsMessage whose visibility timeout was modified.
public String id()
Return values
This function returns a String that represents the ID within the batch of the LrSqsMessage that had its visibility timeout value modified successfully.
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;
}