SQS FIFO with JMS fail to add message group ID

0

I am trying to setup a FIFO queue and integrate with our application using Amazon SQS Java Messaging Library. I have implemented is using the tutorial from Amazon " https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/getting-started.html(Getting Started with the Amazon SQS Java Messaging Library) ". For sending message to SQS FIFO queue, it says to setup the message Group ID (mandatory), which I did as follows:

var textMessage: TextMessage = session.createTextMessage(message)
textMessage.setStringProperty("JMSXGroupID", "Default")
          
LOG.info("Message group ID set to" + textMessage.getStringProperty("JMSXGroupID"))
producer.send(textMessage)

But when I run the code, it's throwing an AmazonServiceException with following trace:

from controllers.util.MyClass$ in application-myJob-90 : Caught while putting messages in the queue: AmazonServiceException: sendMessage. RequestId: 12c4b38d-d274-57b2-8f2b-e142d0bec9b3
HTTPStatusCode: 400 AmazonErrorCode: MissingParameter javax.jms.JMSException: AmazonServiceException: sendMessage. RequestId: 12c4b38d-d274-57b2-8f2b-e142d0bec9b3
HTTPStatusCode: 400 AmazonErrorCode: MissingParameter
...class trace...
Caused by: com.amazonaws.AmazonServiceException: The request must contain the parameter MessageGroupId. (Service: AmazonSQS; Status Code: 400; Error Code: MissingParameter; Request ID: 12c4b38d-d274-57b2-8f2b-e142d0bec9b3)

I tried to look for a solution for this but couldn't find any. Any idea what am I missing here?

Feel free to ask for more details if needed. Any help is highly appreciated.

Edited by: pranav8494 on Jan 10, 2018 2:36 AM

asked 5 years ago325 views
1 Answer
0

Which version of the library are you using? The latest version is 1.0.4 (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-java-message-service-jms-client.html) and support for SQS FIFO queues has been added in version 1.0.2.

Make sure you are not using version older than 1.0.2.

Kuba
answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions