Fix/enhance sqs partial acknowledgement handling#1562
Fix/enhance sqs partial acknowledgement handling#1562tomazfernandes merged 13 commits intoawspring:mainfrom
Conversation
- Changed null to DeleteMessageBatchResponse
tomazfernandes
left a comment
There was a problem hiding this comment.
Thanks for the PR @co2plant, on a first glance looks good.
Notice that SqsAcknowledgementException has a constructor that accepts separate lists for successfully acknowledged messages and failed acknowledgement messages - it would be useful to populate the lists according to AWS response.
Thanks.
DeleteMessageBatch response - Correlate items using message IDs for accurate mapping - Pass different lists to the SqsAcknowledgementException constructor to handle partial failures
- Extract partial error handling logic from the deleteMessages method - Improved code readability and maintainability - placed the calling method at the top and the helper method at the bottom
|
Thanks for the review @tomazfernandes! I was wondering how to separate the failures from the full failures, and your review was very helpful. I updated the code to map item IDs to message IDs based on the AWS responses and populate the success/failure lists.
|
tomazfernandes
left a comment
There was a problem hiding this comment.
Hey @co2plant, looking good.
Left a few suggestions. Also, can you please add a section in the docs explaining how partial Acknowledgement failures are handled?
We could also add to the docs that the resulting SqsAcknowledgementException will be available in AcknowledgementResultCallback, so failed exceptions can be inspected and e.g. retry acknowledging them.
...src/main/java/io/awspring/cloud/sqs/listener/acknowledgement/SqsAcknowledgementExecutor.java
Outdated
Show resolved
Hide resolved
...est/java/io/awspring/cloud/sqs/listener/acknowledgement/SqsAcknowledgementExecutorTests.java
Outdated
Show resolved
Hide resolved
...est/java/io/awspring/cloud/sqs/listener/acknowledgement/SqsAcknowledgementExecutorTests.java
Outdated
Show resolved
Hide resolved
…m SqsAcknowledgementExecutor.
- handle DeleteMessageBatch partial failures in a dedicated method - map AWS failed entry IDs to original message IDs - populate SqsAcknowledgementException with successful/failed message lists - avoid wrapping SqsAcknowledgementException twice - extend SqsAcknowledgementExecutorTests to assert partial failure mapping
- fix callback interface name to AsyncAcknowledgementResultCallback - explain that onFailure receives SqsAcknowledgementException on partial failures - add an example using successful/failed acknowledgement message lists for retry
|
Thanks for the review and guidance @tomazfernandes! I've incorporated your requested changes across the executor, tests, and docs. Additionally, I introduced a separate fail-safe path: if AWS failure response IDs cannot be correlated with request/message IDs, the batch is treated as a full failure to prevent misclassification, so it can be retried safely by the caller. I also added tests for this path, and documented in
|
|
Thanks for the contribution @co2plant, great work! Looking forward to more. |


📢 Type of change
📜 Description
#1497
I first added logging for partial failures.
I checked the directory and found "SqsTemplate.deleteMessages," so I tried to refactor it to match the style as closely as possible.
💡 Motivation and Context
💚 How did you test it?
In the test code (sqs/listener/acknowledgement/SqsAcknowledgementExecutorTests.java), I changed null to DeleteMessageBatchResponse and added code for partial failures.
📝 Checklist
🔮 Next steps