I am using @SqsListener provided by Spring cloud API in order to consume messages from FIFO queue. I want to consume the messages based on the particular Message Group ID. Not sure on where to configure this setting.
I tried to read AWS spring cloud documentation and did some google but cannot find a answer or example.
My annotation looks like this:
@SqsListener(value = orderQueue, deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
And I have following SQS config:
public QueueMessagingTemplate queueMessagingTemplate(AmazonSQSAsync amazonSQSAsync) {
return new QueueMessagingTemplate(amazonSQSAsync);
}
and using following dependency:
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws-messaging</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
I am mainly looking for answer on how to configure @SqsListener to read messages based on Message Group Id.
I don't think that even the AWS sdk provides a way to consume messages by their groupId. The groupId is basically just a mechanism to build clusters of messages in Fifo queues. Messages within a cluster are then guaranteed to be delivered in the order they were sent.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.