Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(events-targets): Add retry policy #13659

Closed
1 of 2 tasks
DaWyz opened this issue Mar 18, 2021 · 1 comment · Fixed by #13660
Closed
1 of 2 tasks

(events-targets): Add retry policy #13659

DaWyz opened this issue Mar 18, 2021 · 1 comment · Fixed by #13660
Assignees
Labels
@aws-cdk/aws-events-targets effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md needs-triage This issue or PR still needs to be triaged. p1

Comments

@DaWyz
Copy link
Contributor

DaWyz commented Mar 18, 2021

Event Targets support retry policies (retryAttempts and maxEventAge). It should be a low effort to add this feature to the Event Targets constructs.

Proposed Solution

add retryAttempts and maxEventAge properties to the targets so it can be configured without escape hatches.

import * as lambda from "@aws-cdk/aws-lambda";
import * as events from "@aws-cdk/aws-events";
import * as sqs from "@aws-cdk/aws-sqs";
import * as targets from "@aws-cdk/aws-events-targets";
import * as cdk from '@aws-cdk/core';

const fn = new lambda.Function(this, 'MyFunc', {
  runtime: lambda.Runtime.NODEJS_12_X,
  handler: 'index.handler',
  code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`),
});

const rule = new events.Rule(this, 'rule', {
  eventPattern: {
    source: ["aws.ec2"],
  },
});

const queue = new sqs.Queue(this, 'Queue');

rule.addTarget(new targets.LambdaFunction(fn, {
  deadLetterQueue: queue, // Optional: add a dead letter queue
  maxEventAge: cdk.Duration.hours(2), // Otional: set the maxEventAge retry policy
  retryAttempts: 2, // Optional: set the max number of retry attempts
}));
  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@DaWyz DaWyz added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 18, 2021
@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1 labels Mar 22, 2021
@mergify mergify bot closed this as completed in #13660 Mar 24, 2021
mergify bot pushed a commit that referenced this issue Mar 24, 2021
Add retry policy (+ dead letter queue) support for the following targets:
 
- Lambda
- LogGroup
- CodeBuild
- CodePipeline
- StepFunction

Closes #13659 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

eladb pushed a commit that referenced this issue Mar 24, 2021
Add retry policy (+ dead letter queue) support for the following targets:
 
- Lambda
- LogGroup
- CodeBuild
- CodePipeline
- StepFunction

Closes #13659 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Mar 24, 2021
Add retry policy (+ dead letter queue) support for the following targets:
 
- Lambda
- LogGroup
- CodeBuild
- CodePipeline
- StepFunction

Closes aws#13659 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
Add retry policy (+ dead letter queue) support for the following targets:
 
- Lambda
- LogGroup
- CodeBuild
- CodePipeline
- StepFunction

Closes aws#13659 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-events-targets effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md needs-triage This issue or PR still needs to be triaged. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants