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

gefragt vor 6 Jahren1305 Aufrufe
1 Antwort
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
beantwortet vor 6 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen