Share this page

# LrSqsSendMessageBatchStatusEntry.id

Returns the ID within the batch of the LrSqsMessage that was sent.

`public String id()`

## Return values

This function returns a String that represents the ID within the batch of the LrSqsMessage that was sent successfully.

## Example

Copy code

    public int action() throws Throwable {
            LrSqsClient.initClient(region, fifoQueueUrl);
            LrSqsClient.initMessageBatch();
            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: " + entry.id());
                    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: " + entry.id());
                    lr.output_message("Error code: " + entry.code());
                    lr.output_message("Error message: " + entry.message());
                    lr.output_message("Is it my fault? : " + entry.senderFault());
                }
            }

            LrSqsClient.closeClient();

            return 0;
        }

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: