-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Amazon EventBridge recently added support for dead letter queues.
Use Case
It makes event-driven applications more resilient and durable by storing your events in queues when the events can't be delivered, or the target is unavailable. See the documentation for more information.
Proposed Solution
Following the CloudFormation documentation, it is possible to pass the deadLetterConfig at the rule level and at the target level. I suspect it makes more sense to set it at the target level so we can target different DLQs for targets on the same rule if needed.
A target would have the possibility to pass a Queue as a property. That would be straight forward. Also, we would need to attach a policy to the queue to allow the rule to SendMessage to the queue.
See below a usage example.
import * as logs from "@aws-cdk/aws-logs";
import * as sqs from "@aws-cdk/aws-sqs";
import * as events from "@aws-cdk/aws-events";
import * as targets from "@aws-cdk/aws-events-targets";
const logGroup = new logs.LogGroup(this, 'MyLogGroup', {
logGroupName: 'MyLogGroup',
});
const rule = new events.Rule(this, 'rule', {
eventPattern: {
source: ["aws.ec2"],
},
});
const myDeadLetterQueue = new sqs.Queue(this, 'Queue');
rule.addTarget(new targets.CloudWatchLogGroup(logGroup, {
deadLetterQueue: myDeadLetterQueue
}));Others
I'm happy to have a go at it.
- 👋 I may be able to implement this feature request
-
⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request