SqsEventSourceProps
- class aws_cdk.aws_lambda_event_sources.SqsEventSourceProps(*, batch_size=None, enabled=None, filter_encryption=None, filters=None, max_batching_window=None, max_concurrency=None, metrics_config=None, report_batch_item_failures=None)
Bases:
object
- Parameters:
batch_size (
Union
[int
,float
,None
]) – 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. IfmaxBatchingWindow
is configured, this value can go up to 10,000. Default: 10enabled (
Optional
[bool
]) – If the SQS event source mapping should be enabled. Default: truefilter_encryption (
Optional
[IKey
]) – Add Customer managed KMS key to encrypt Filter Criteria. Default: - nonefilters (
Optional
[Sequence
[Mapping
[str
,Any
]]]) – Add filter criteria option. Default: - Nonemax_batching_window (
Optional
[Duration
]) – The maximum amount of time to gather records before invoking the function. Valid Range: Minimum value of 0 minutes. Maximum value of 5 minutes. Default: - no batching window. The lambda function will be invoked immediately with the records that are available.max_concurrency (
Union
[int
,float
,None
]) – The maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke. Default: - No specific limit.metrics_config (
Union
[MetricsConfig
,Dict
[str
,Any
],None
]) – Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source. Default: - Enhanced monitoring is disabledreport_batch_item_failures (
Optional
[bool
]) – Allow functions to return partially successful responses for a batch of records. Default: false
- ExampleMetadata:
infused
Example:
from aws_cdk.aws_lambda_event_sources import SqsEventSource # fn: lambda.Function queue = sqs.Queue(self, "MyQueue", visibility_timeout=Duration.seconds(30) ) fn.add_event_source(SqsEventSource(queue, batch_size=10, # default max_batching_window=Duration.minutes(5), report_batch_item_failures=True ))
Attributes
- batch_size
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.- Default:
10
- enabled
If the SQS event source mapping should be enabled.
- Default:
true
- filter_encryption
Add Customer managed KMS key to encrypt Filter Criteria.
- filters
Add filter criteria option.
- Default:
None
- max_batching_window
The maximum amount of time to gather records before invoking the function.
Valid Range: Minimum value of 0 minutes. Maximum value of 5 minutes.
- Default:
no batching window. The lambda function will be invoked immediately with the records that are available.
- max_concurrency
The maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke.
- Default:
No specific limit.
- See:
https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-max-concurrency
Valid Range: Minimum value of 2. Maximum value of 1000.
- metrics_config
Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.
- Default:
Enhanced monitoring is disabled
- report_batch_item_failures
Allow functions to return partially successful responses for a batch of records.