interface SqsEventSourceProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Lambda.EventSources.SqsEventSourceProps |
![]() | software.amazon.awscdk.services.lambda.eventsources.SqsEventSourceProps |
![]() | aws_cdk.aws_lambda_event_sources.SqsEventSourceProps |
![]() | @aws-cdk/aws-lambda-event-sources » SqsEventSourceProps |
Example
import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
const queue = new sqs.Queue(this, 'MyQueue', {
visibilityTimeout: Duration.seconds(30), // default,
receiveMessageWaitTime: Duration.seconds(20), // default
});
declare const fn: lambda.Function;
fn.addEventSource(new SqsEventSource(queue, {
batchSize: 10, // default
maxBatchingWindow: Duration.minutes(5),
reportBatchItemFailures: true, // default to false
}));
Properties
Name | Type | Description |
---|---|---|
batch | number | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
enabled? | boolean | If the SQS event source mapping should be enabled. |
max | Duration | The maximum amount of time to gather records before invoking the function. |
report | boolean | Allow functions to return partially successful responses for a batch of records. |
batchSize?
Type:
number
(optional, default: 10)
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
Your function receives an event with all the retrieved records.
Valid Range: Minimum value of 1. Maximum value of 10.
If maxBatchingWindow
is configured, this value can go up to 10,000.
enabled?
Type:
boolean
(optional, default: true)
If the SQS event source mapping should be enabled.
maxBatchingWindow?
Type:
Duration
(optional, default: no batching window. The lambda function will be invoked immediately with the records that are available.)
The maximum amount of time to gather records before invoking the function.
Valid Range: Minimum value of 0 minutes. Maximum value of 5 minutes.
reportBatchItemFailures?
Type:
boolean
(optional, default: false)
Allow functions to return partially successful responses for a batch of records.