use aws sqs for different message types

Viewed 2153

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.

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.

Related