Deletes a message batch from the queue.

public static LrSqsDeleteMessageBatchRequestStatus deleteMessageBatch(Collection<?> batch)


batchA collection of LrSqsMessage or Strings (handle receipts)

Return values

The function returns an LrSqsDeleteMessageBatchRequestStatus object. For details, see LrSqsDeleteMessageBatchRequestStatus.

General information

This function deletes a message batch. It works in the same way as LrSqsClient.deleteMessage, but applies to a message batch instead of an individual message.

The batch can hold any number of messages. Upon calling the deleteMessageBatch() function, the batch is split into smaller collections, of at most 10 messages each, and each such collection is deleted in a separate request.


Copy code
public void receiveMessageTest(){
        LrSqsClient.initClient(region, standardQueueUrl);
        LrSqsMessage message = LrSqsClient.receiveMessage();
        lr.output_message("Got 1 message: " + message.body());
        List<LrSqsMessage> collection = LrSqsClient.receiveMessages(5, 20);
        for (LrSqsMessage m : collection) {
            lr.output_message("Got message in collection: " + m.body());
        List<LrSqsMessage> collectionEx =   LrSqsClient.receiveMessagesEx(3, 20, null, null, new ArrayList() {{ add("MessageGroupId"); }}, null);
        for (LrSqsMessage m : collectionEx) {
            String messageGroupId = m.systemAttributesAsStrings().get("MessageGroupId");
            lr.log_message("Got message in collectionEX: " + messageGroupId + " " + m.body());
        LrSqsDeleteMessageBatchRequestStatus status = LrSqsClient.deleteMessageBatch(collectionEx);