Deletes a message from the queue.

public static void deleteMessage(String receiptHandle)

public static void deleteMessage(LrSqsMessage message)


receiptHandleThe handle contained within the LrSqsMessage.
messageThe LrSqsMessage to delete.

Return values

The function does not return any values.

General information

This function deletes a message from the queue. The message can be identified by the receipt handle, or by the full message. The message is also deleted from the queue by default after a period of time that is set when the queue is configured.


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);