I know SQS has the maxReceiveCount and once the message has been consumed and failed this amount of times, then the message is moved to the DLQ. That's working currently.
However, there are certain errors which I would want to go back in my source queue indefinitely e.g. if we get a 5XX error from an API we are invoking. This is very likely to be temporary, and so we would want to retry these until they are successful.
Now if these 5XX failed messages do go to the DLQ, it's not the end of the world, but it requires a manual redrive.
Is there a known solution or aws feature which allows for conditionally moving messages to the DLQ depending on the error received?
I'm not sure this is possible. I've read the documentation and can't find anything that hints at how to achieve this.