Home > Back-end >  Can I redrive messages from an SQS queue that is an onFailure target from a Lambda function back to
Can I redrive messages from an SQS queue that is an onFailure target from a Lambda function back to

Time:06-30

I have an SQS queue (Q) that receives messages via the onFailure "destinations" setting from a Lambda function (F). The Lambda function is triggered by and EventBridge event bus "rule".

My question is: Can I configure the redrive policy of queue Q so that I can redrive messages directly to function F?

Currently, I have set the redrive allow policy to allowAll, but the "Start DLQ Redrive" button is disabled in the console. Looking at the configuration settings for the drive allow policy, I get the feeling that only other queues can be a target for a redrive.

What confuses me about this is that my goal here was to use the onFailure function of the "destinations" feature. Destinations can only be used when a function is called asynchronously and queues trigger lambdas synchronously. So if I were to put a queue in front of my lambda function F that could be a target for a redrive, then I would not be able to use the onFailure destination.

CodePudding user response:

It's not possible to send an event payload from Queue Q to Lambda F with redrive. Redrive works by sending messages from the DLQ back to the source queue, not directly to a Lambda target. Consider, too that the SQS message structure differs from that of EventBridge events, which would confuse your Lambda.

Check out Event replay as an alternative. Or add a Lambda to periodically read from the DLQ and resubmit the events.

  • Related