We have an SNS having AWS Lambda as a target, and there's a DLQ associated with the SNS for handling Lambda throttling or other errors. We want to implement an automated retry system that resends the messages from DLQ to SNS. However, we want to be intelligent about it and ensure that it doesn't blindly forwards messages to SNS. We need a mechanism to check whether the lambda is throttled or if it has breached the reserved concurrency. We are considering a solution using Cloud Watch lambda metrics specifically 'Throttles' and 'Errors' using Java SDK.
Could someone please advise if this solution is feasible, and how can we implement it using Java SDK? Moreover, are there any alternative solutions or recommendations for this problem?