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

已提问 6 年前1298 查看次数
1 回答
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
已回答 6 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则