Skip to content

Commit 6a6bf65

Browse files
docs(lambda-destination): add onFailure destination example and be explicit about the type of SQS queue that can be used (#17283)
---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* closes #13793
1 parent e5259ee commit 6a6bf65

File tree

1 file changed

+18
-1
lines changed
  • packages/@aws-cdk/aws-lambda-destinations

1 file changed

+18
-1
lines changed

packages/@aws-cdk/aws-lambda-destinations/README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Destinations can be added by specifying the `onFailure` or `onSuccess` props whe
1717
The following destinations are supported
1818

1919
* Lambda function
20-
* SQS queue
20+
* SQS queue - Only standard SQS queues are supported for failure destinations, FIFO queues are not supported.
2121
* SNS topic
2222
* EventBridge event bus
2323

@@ -38,6 +38,23 @@ const myFn = new lambda.Function(this, 'Fn', {
3838
})
3939
```
4040

41+
Example with a SQS queue for unsuccessful invocations:
42+
43+
```ts
44+
// An sqs queue for unsuccessful invocations of a lambda function
45+
import * as sqs from '@aws-cdk/aws-sqs';
46+
47+
const deadLetterQueue = new sqs.Queue(this, 'DeadLetterQueue');
48+
49+
const myFn = new lambda.Function(this, 'Fn', {
50+
runtime: lambda.Runtime.NODEJS_12_X,
51+
handler: 'index.handler',
52+
code: lambda.Code.fromInline('// your code'),
53+
// sqs queue for unsuccessful invocations
54+
onFailure: new destinations.SqsDestination(deadLetterQueue),
55+
});
56+
```
57+
4158
See also [Configuring Destinations for Asynchronous Invocation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations).
4259

4360
### Invocation record

0 commit comments

Comments
 (0)