I have four current consumers listening to the same queue on Amazon AWS. When pulling message down from the queue, it appears sometimes the same message is consumed by two different consumers. Please see the log below:
18:01:46,515 [jmsContainer-2] DEBUG - Received message from the queue: ID:3698a927-930b-4d6a-aeca-f66922528792
18:02:12,825 [jmsContainer-3] DEBUG - Received message from the queue: ID:3698a927-930b-4d6a-aeca-f66922528792
I have a JMS container setup with 4 concurrent consumers. I have the visibility timeout set to 30s.
Since the message is received by container2, how come container3 is still able to access it?
Does JMS container do auto-acknowledgment before or after the execution of the listener method (handleMessage)?
Amazon does not guarantee exactly once delivery with SQS. They guarantee "at least once" delivery. This is addressed in the FAQ https://aws.amazon.com/sqs/faqs/
You have to keep this in mind and design your system to gracefully handle duplicate message delivery.
This is possible now with FIFO SQS queues. You can make sure exactly one client receives the message and then delete it while the message is in-flight
More information here:
https://aws.amazon.com/about-aws/whats-new/2016/11/amazon-sqs-introduces-fifo-queues-with-exactly-once-processing-and-lower-prices-for-standard-queues/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With