Returns the sequence number of the LrSqsMessage.

public String sequenceNumber()

Return values

This function returns a String value that represents the sequence number of the LrSqsMessage that was sent successfully using the sendMessageBatch method.

General information

The sequence number only applies to FIFO queues. In FIFO queues, SQS assigns a 128-bit number that represents the sequence number of the message. This is unique for a message group ID.


Copy code
public int action() throws Throwable {
        LrSqsClient.initClient(region, fifoQueueUrl);
        LrSqsClient.addMessageToBatch("batch message 0", "group1","dupID1");
        LrSqsClient.addMessageToBatch("batch message 1","group1","dupID2");
        HashMap<String, LrSqsMessageAttributeValue> messageAttributes = new HashMap<String, LrSqsMessageAttributeValue>();
        messageAttributes.put("attr1", LrSqsClient.createMessageAttributeValueString("my string attribute value"));
        messageAttributes.put("attr2", LrSqsClient.createMessageAttributeValueInt("1234"));
        LrSqsClient.addMessageToBatchEx("batch message 2", "group1","dupID3", "specialId_inBatch", messageAttributes);
        LrSqsSendMessageBatchRequestStatus batchResponse = LrSqsClient.sendMessageBatch();
        if (batchResponse.hasSuccessful()){
            Collection<LrSqsSendMessageBatchStatusEntry> successful_res = batchResponse.successful();
            if (successful_res.size() > 3)
                lr.error_message("batch size is not ok: " + successful_res.size());
            for (LrSqsSendMessageBatchStatusEntry entry : successful_res){
                lr.output_message("Message id within batch: " +;
                lr.output_message("Message id: " + entry.messageId());
                lr.output_message("Message sequence number: " + entry.messageId());
        if (batchResponse.hasFailed()){
            Collection<LrSqsBatchErrorResultEntry> failed_res = batchResponse.failed();
            if (failed_res.size() > 3)
                lr.error_message("batch size is not ok: " + failed_res.size());
            for (LrSqsBatchErrorResultEntry entry : failed_res){
                lr.output_message("Message id within batch: " +;
                lr.output_message("Error code: " + entry.code());
                lr.output_message("Error message: " + entry.message());
                lr.output_message("Is it my fault? : " + entry.senderFault());

        return 0;