awslabs / awslabs/amazon-sqs-java-messaging-lib
same sqs message consumed by multiple sqs-sdk clients & also message resulted in dead queue
- Dominant language
- Java
- Stars
- 183
- Forks
- 150
- PR merge metrics
- No merged PRs in 30d
Description
We are using com.amazonaws:aws-java-sdk:1.9.6 & com.amazonaws:amazon-sqs-java-messaging-lib:1.0.3 libraries for consuming the messages from SQS. We use Spring JMSTemplate for consume the messages with CLIENT_ACKNOWLEDGE mode.
We noticed an issue where multiple consumers picked the same message & also the message moved to the dead queue on sqs. When we inquired with AWS SQS support team, Below is the response (in quotes) we received. Can you let us know if any configuration is missing & what kind of logging needs to be enabled to debug this issue ?
"After looking at logs, below is why the message was returned 5 times within 1 second.
For each ReceiveMessage call, I see a ChangeMessageVisibilityBatch call with visibility timeout set to 0. This call was putting the message back in available state right away, allowing other consumers to pick the message. Below is the caller of ChangeMessageVisibilityBatch call.
UserAgent: aws-sdk-java/1.11.18 Linux/3.10.0-693.11.6.el7.x86_64 Java_HotSpot(TM)_64-Bit_Server_VM/25.131-b11/1.8.0_131 /SQS Java Messaging Client v1.0
Look like, it is the same code making both calls (ReceiveMessage and ChangeMessageVisibilityBatch). In order to understand why these calls were made in the first place, I request you to enable debug logging in the code. For any other issues with the library, I recommend opening an issue in the github repo. Our team that manages the library will address them.
"
Contributor guide
Assessment
This issue has not been assessed yet.