Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use aws sqs for different message types

I am using AWS SQS and Spring JMS in my project. I have my method with @JmsListener(destination = "queue_name"). I want to use this queue for two different types of messages.

Since this listener is configured to this queue it receives both types of messages. What I am trying to achieve is to ignore message of one type. (Sender is adding a MessageAttribute while sending message to Queue). So, is there a way to just ignore message coming from sender 2 so this method won't process them.

Also, I have DLQ set on this queue with max receives as 5. So if message is not processed in first 5 attempts it gets moved to DLQ.

Please do share your suggestion.

Thanks.

like image 791
user1246979 Avatar asked Oct 16 '25 15:10

user1246979


1 Answers

The correct solution is to use 2 different queues; SQS can't filter the messages delivered by any property, so as you are seeing, when the client reads the message and doesn't process it, it is going to end up in your DLQ quicker.

Queues are free, so having multiple won't cost any more.

like image 142
E.J. Brennan Avatar answered Oct 18 '25 19:10

E.J. Brennan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!