You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Customers have to decorate their Lambda handler with batch_processor decorator to repeatedly call a record handler for each record it walks through.
Historically, this was kept for backwards compatibility reasons as we moved from the original Batch that used AWS SDK to delete successful messages to the native Lambda integration launched two years later.
The new integration required a strict response to make it work, so we introduced a new property .response in the processor, so the Lambda handler could return it in the right format.
Now that we introduced async along with some refactoring and the new typing extensions, we have access to better tools and we can make it easier to customers onboard to the Batch feature by removing this unnecessary boilerplate in a backwards compatible way.
Solution/User Experience
We can introduce a new function, call it process_partial_response for the sake of argument, that is responsible to:
Extract Records[*] from the event, whether that is a dict or a Parser's SQS Model
Call the processor .process sync using the given record handler
Extract the final response from the processor and simply return it to the caller
Benefits. Besides reducing boilerplate and accelerate on-boarding, it'll reduce the call stack in Python improving performance a tiny wee bit.
Hi @heitorlessa! I understand the developer experience proposition behind this change and it makes sense to create this new function process_partial_response. When you send the PR I can review.
Use case
Customers have to decorate their Lambda handler with
batch_processor
decorator to repeatedly call a record handler for each record it walks through.Historically, this was kept for backwards compatibility reasons as we moved from the original Batch that used AWS SDK to delete successful messages to the native Lambda integration launched two years later.
The new integration required a strict response to make it work, so we introduced a new property
.response
in the processor, so the Lambda handler could return it in the right format.Now that we introduced async along with some refactoring and the new typing extensions, we have access to better tools and we can make it easier to customers onboard to the Batch feature by removing this unnecessary boilerplate in a backwards compatible way.
Solution/User Experience
We can introduce a new function, call it
process_partial_response
for the sake of argument, that is responsible to:Records[*]
from the event, whether that is a dict or a Parser's SQS Model.process
sync using the given record handlerBenefits. Besides reducing boilerplate and accelerate on-boarding, it'll reduce the call stack in Python improving performance a tiny wee bit.
Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: