class EventInvokeConfig (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Lambda.EventInvokeConfig |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awslambda#EventInvokeConfig |
![]() | software.amazon.awscdk.services.lambda.EventInvokeConfig |
![]() | aws_cdk.aws_lambda.EventInvokeConfig |
![]() | aws-cdk-lib » aws_lambda » EventInvokeConfig |
Implements
IConstruct
, IDependable
, IResource
Configure options for asynchronous invocation on a version or an alias.
By default, Lambda retries an asynchronous invocation twice if the function returns an error. It retains events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous invocation queue for too long, Lambda discards it.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
declare const destination: lambda.IDestination;
declare const function_: lambda.Function;
const eventInvokeConfig = new lambda.EventInvokeConfig(this, 'MyEventInvokeConfig', {
function: function_,
// the properties below are optional
maxEventAge: cdk.Duration.minutes(30),
onFailure: destination,
onSuccess: destination,
qualifier: 'qualifier',
retryAttempts: 123,
});
Initializer
new EventInvokeConfig(scope: Construct, id: string, props: EventInvokeConfigProps)
Parameters
- scope
Construct
- id
string
- props
Event
Invoke Config Props
Construct Props
Name | Type | Description |
---|---|---|
function | IFunction | The Lambda function. |
max | Duration | The maximum age of a request that Lambda sends to a function for processing. |
on | IDestination | The destination for failed invocations. |
on | IDestination | The destination for successful invocations. |
qualifier? | string | The qualifier. |
retry | number | The maximum number of times to retry when the function returns an error. |
function
Type:
IFunction
The Lambda function.
maxEventAge?
Type:
Duration
(optional, default: Duration.hours(6))
The maximum age of a request that Lambda sends to a function for processing.
Minimum: 60 seconds Maximum: 6 hours
onFailure?
Type:
IDestination
(optional, default: no destination)
The destination for failed invocations.
onSuccess?
Type:
IDestination
(optional, default: no destination)
The destination for successful invocations.
qualifier?
Type:
string
(optional, default: latest version)
The qualifier.
retryAttempts?
Type:
number
(optional, default: 2)
The maximum number of times to retry when the function returns an error.
Minimum: 0 Maximum: 2
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.