feat: batch typed decorator
Please provide the issue number
Issue number: closes #1033
Summary
Changes
Full support for TypedRecordHandler and TypedRecordHandlerWithContext
public class Product
{
public int Id { get; set; }
public string? Name { get; set; }
public decimal Price { get; set; }
}
public class TypedSqsRecordHandler : ITypedRecordHandler<Product> // (1)!
{
public async Task<RecordHandlerResult> HandleAsync(Product product, CancellationToken cancellationToken)
{
/*
* Your business logic with automatic deserialization.
* If an exception is thrown, the item will be marked as a partial batch item failure.
*/
Logger.LogInformation($"Processing product {product.Id} - {product.Name} (${product.Price})");
if (product.Id == 4) // (2)!
{
throw new ArgumentException("Error on id 4");
}
return await Task.FromResult(RecordHandlerResult.None); // (3)!
}
}
[BatchProcessor(TypedRecordHandler = typeof(TypedSqsRecordHandler))]
public BatchItemFailuresResponse HandlerUsingTypedAttribute(SQSEvent _)
{
return TypedSqsBatchProcessor.Result.BatchItemFailuresResponse; // (4)!
}
User experience
Please share what the user experience looks like before and after this change
Checklist
Please leave checklist items unchecked if they do not apply to your change.
- [ ] Meets tenets criteria
- [ ] I have performed a self-review of this change
- [ ] Changes have been tested
- [ ] Changes are documented
- [ ] PR title follows conventional commit semantics
Is this a breaking change?
RFC issue number:
Checklist:
- [ ] Migration process documented
- [ ] Implement warnings (if it can live side by side)
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.
the documentation file was wrongly formated fixed, so looks like the whole file changed but in reality just one line
Codecov Report
:x: Patch coverage is 78.57143% with 48 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 78.33%. Comparing base (12573e5) to head (a83f3d0).
:warning: Report is 5 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #1034 +/- ##
===========================================
+ Coverage 78.17% 78.33% +0.16%
===========================================
Files 298 299 +1
Lines 12012 12231 +219
Branches 1443 1473 +30
===========================================
+ Hits 9390 9581 +191
- Misses 2160 2181 +21
- Partials 462 469 +7
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
cc @lachriz-aws
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code