spring-attic / spring-cloud-aws

All development has moved to https://github.com/awspring/spring-cloud-aws Integration for Amazon Web Services APIs with Spring
https://awspring.io/
Apache License 2.0
589 stars 376 forks source link

Messages retrieved from a FIFO with same messageGroupId are processed concurrently #756

Closed tristanexsquare closed 3 years ago

tristanexsquare commented 3 years ago

Type: Bug

Component: SQS

Describe the bug In our application we are using multiple SqsListener annotations to retrieve sqs messages from FIFO and non-FIFO queues. We are using the default setting for maxNumberOfMessages (10) in order to keep the number of requests made to AWS as low as possible.

The messages retrieved from FIFO queues with same messageGroupId are processed concurrently. We are expecting these groups messages to be processed one after another.

The reason for this behaviour is that the messages are retrieved in a bulk of 10 (maxNumberOfMessages) and even though AWS delivers messages with same messageGroupId in the order they have been put into the queue, the SimpleMessageListenerContainer ignores the order within the group and treats all messages equally. All messages are put into the ThreadPool and thus are processed concurrently.

Project: spring-cloud-aws/spring-cloud-aws-messaging Version: 2.x.x

fmalhe commented 3 years ago

I just bumped into this exact same issue in one of my services. I am hopeful that the PR opened to fix it can be merged/released soon.