I'm using spring-cloud-aws to send a message to SQS FIFO queue.
It's failing with
The request must contain the parameter MessageGroupId
There doesn't seem to be anywhere on the QueueMessagingTemplate in spring-cloud-aws-messaging that allows me to set this mandatory MessageGroupId.
Is there currently a way of writing to a SQS FIFO queue in this manor or would I have to revert to directly using amazons API?
Spring Cloud AWS support FIFO queues since 2017, in accordance with: Add Support for FIFO SQS Queues #252
You just need to add the two required params(messageGroupId and messageDeduplicationId) like example below:
public void send(String topicName, Object message, String messageGroupId, String messageDeduplicationId) throws MessagingException {
Map<String, Object> headers = new HashMap<>();
headers.put("message-group-id", messageGroupId);
headers.put("message-deduplication-id", messageDeduplicationId);
messagingTemplate.convertAndSend(topicName, message, headers);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With