Description
Summary
The current implementation of the Batch Processing utility allows you to register an handler function that is executed for each record in a batch. This function can be both synchronous and asynchronous. In order to allow for async functions the current process()
method has been implemented as async
and always returns a Promise
.
This requires the caller to have to await
the result and handle the promise. When the caller passes a synchronous handler this might result counterintuitive, even though the addition of a Promise
technically is a no-op.
This discussion arose during the review of the first PR for the utility (here), however at that time it was too early to make a decision and so we have decided to postpone the topic until later in the implementation.
Why is this needed?
So that we can review whether the current implementation is appropriate and decide if we need to change the types, add a new methods to distinguish between sync/async processing, or split the classes entirely.
Which area does this relate to?
Other
Solution
No response
Acknowledgment
- This request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status