Sends a message to the queue.

public static LrSqsSendMessageResult sendMessage(String messageBody)

public static LrSqsSendMessageResult sendMessage(String messageBody, String messageGroupId)

public static LrSqsSendMessageResult sendMessage(String messageBody, String messageGroupId, String messageDeduplicationId)


messageBodyThe message body to be sent.
messageGroupIdThe message group to which the message belongs.
messageDeduplicationIdThe deduplication ID of the message.

Return values

This function returns an LrSqsSendMessageResult object. For details, see LrSqsSendMessageResult.

General information

This function sends a specific message to the queue.

If the message is specified only by its body, the queue must be a standard one. If the message also has other attributes - group ID or deduplication ID - the queue must be of the type FIFO (first in first out).

Group ID is an attribute that is used to send the message to a specific group. Within a group, the messages are consumed in strict order.

AWS FIFO queues do not accept duplicates that are sent in a small interval of time. The duplication is verified according to the deduplication ID. If a message with a deduplication ID is sent successfully, another message with the same ID will be accepted, but only if at least 5 minutes have passed since the first message.


Copy code
public int action() throws Throwable {

    String standardQueueUrl = "";
    String fifoQueueUrl = "";
    LrAwsRegion region = LrAwsRegion.EU_CENTRAL_1;
    LrSqsClient.initClient(region, standardQueueUrl);
    LrSqsSendMessageResult result1 = LrSqsClient.sendMessage("hi");
    lr.output_message("message ID: " + result1.messageId());
    result1 = LrSqsClient.sendMessage("hi", "group0", "1");
    lr.output_message("message ID: " + result1.messageId());
    lr.output_message("sequenceNumber: " + result1.sequenceNumber());

    return 0;