1.8.4
Summary
In this release we are excited to announce the General Availability of Batch Processing utility.
Batch Processing
The batch processing utility handles partial failures when processing batches from Amazon SQS, Amazon Kinesis Data Streams, and Amazon DynamoDB Streams.
Key features
- Reports batch item failures to reduce number of retries for a record upon errors
- Simple interface to process each batch record
- Bring your own batch processor
- Parallel processing
Problem Statement
When using SQS, Kinesis Data Streams, or DynamoDB Streams as a Lambda event source, your Lambda functions are triggered with a batch of messages.
If your function fails to process any message from the batch, the entire batch returns to your queue or stream. This same batch is then retried until either condition happens first: a) your Lambda function returns a successful response, b) record reaches maximum retry attempts, or c) when records expire.
With this utility, batch records are processed individually – only messages that failed to be processed return to the queue or stream for a further retry.
Getting started
To get started add the NuGet package
dotnet add package AWS.Lambda.Powertools.BatchProcessing
Example of processing batches from SQS using Lambda handler decorator in three stages:
- Decorate your handler with BatchProcessor attribute
- Create a class that implements ISqsRecordHandler interface and the HandleAsync method.
- Pass the type of that class to RecordHandler property of the BatchProcessor attribute
- Return BatchItemFailuresResponse from Lambda handler using SqsBatchProcessor.Result.BatchItemFailuresResponse
Changes
📜 Documentation updates
🔧 Maintenance
- chore: Update version for batch GA (#532) by @hjgraca
- chore: Update examples idempotency (#528) by @hjgraca
This release was made possible by the following contributors:
@hjgraca and @lachriz-aws