I want to distinguish the messages after retreiving from aws fifo sqs for routing to correct processor. And I planned to utilize the MessageGroupId , which I set while sending the request. I am using Java sdk. sendMessageRequest.setMessageGroupId(messageGroupId);
Documentation says it can be retrieved as request parameter of AttributeName
MessageGroupId - Returns the value provided by the sender that calls the SendMessage action. Messages with the same MessageGroupId are returned in sequence. However, I could not find the correct way/method to do so. There is no attribute MessageGroupId present and size is 0.
List<Message> messages = sqs.receiveMessage(receiveMessageRequest).getMessages();
for (Message message : messages)
{
System.out.println(" Size getAttributes: " + message.getAttributes() .size());
}
Only if I set any attribute explicitly then it is retreivable (like with MESSAGEPRIORITY), but how to receive the values of attributes like MessageGroupId?
Help is appreciated.