-
-
Notifications
You must be signed in to change notification settings - Fork 333
#1041 Enable receiving messages from different message groups i… #1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1041 Enable receiving messages from different message groups i… #1134
Conversation
…n the same Batch for FIFO queues Added a new SqsContainerOptions option : messageGrouping. True by default.
spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/FifoSqsComponentFactory.java
Outdated
Show resolved
Hide resolved
spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java
Outdated
Show resolved
Hide resolved
spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java
Outdated
Show resolved
Hide resolved
Thanks for the PR @alexisgra! Left a few comments for your consideration. |
…rategy Rename messageGrouping by batchGroupingStrategy and add an enum as suggested for better extensibility. Remove the message grouping option from SQSListener annotation
Thank you very much for the review @tomazfernandes ! |
spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptions.java
Outdated
Show resolved
Hide resolved
...ng-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/FifoBatchGroupingStrategy.java
Outdated
Show resolved
Hide resolved
...ng-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/FifoBatchGroupingStrategy.java
Show resolved
Hide resolved
…operty to fifoBatchGroupingStrategy
Thanks for the review @tomazfernandes ! |
Thanks a lot for the PR @alexisgra! I did some polishing to speed up merging and opened a new PR: #1192, so I'll close this one. Looking forward to more! |
…n the same Batch for FIFO queues
📢 Type of change
📜 Description
Added a new SqsContainerOptions option :
messageGrouping
. True by default. When false, a newMessageSinkAdapter
is used. This adapter does not have grouping function.I was wondering whether I should add the new option
messageGrouping
in the@SqsListener
annotation or leave the configuration only in the factory.Although the option is only relevant for FIFO Queues with a listener in
batch
mode, I've decided to put the option in@SqsListener
, which will make it easier for library users to configure.I don't know if the name
messageGrouping
is meaningful enough, I can change it if necessary.💡 Motivation and Context
Fix the issue #1041
💚 How did you test it?
I added a test in
SqsFifoIntegrationTests
. In this test, I configure a new listener withmessageGrouping
set tofalse
. I send several messages from two different message groups.In the listener, I verify that the batch of messages received contains messages from different message groups. Then, I check that all messages from each group have been received.
📝 Checklist
🔮 Next steps