use of com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchRequestEntry in project aws-doc-sdk-examples by awsdocs.
the class VisibilityTimeout method changeMessageVisibilityMultiple.
// Change the visibility timeout for multiple messages.
public static void changeMessageVisibilityMultiple(String queue_url, int timeout) {
AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient();
List<ChangeMessageVisibilityBatchRequestEntry> entries = new ArrayList<ChangeMessageVisibilityBatchRequestEntry>();
entries.add(new ChangeMessageVisibilityBatchRequestEntry("unique_id_msg1", sqs.receiveMessage(queue_url).getMessages().get(0).getReceiptHandle()).withVisibilityTimeout(timeout));
entries.add(new ChangeMessageVisibilityBatchRequestEntry("unique_id_msg2", sqs.receiveMessage(queue_url).getMessages().get(0).getReceiptHandle()).withVisibilityTimeout(timeout + 200));
sqs.changeMessageVisibilityBatch(queue_url, entries);
}
Aggregations