Skip to content

Conversation

hjgraca
Copy link
Contributor

@hjgraca hjgraca commented Sep 1, 2025

Please provide the issue number

Issue number: #969

Summary

Changes

This pull request adds strongly-typed batch processing with automatic deserialization support for SQS, Kinesis, and DynamoDB events.

New Features

  • Typed Record Handlers: ITypedRecordHandler and ITypedRecordHandlerWithContext interfaces for strongly-typed processing
  • Typed Batch Processors: TypedSqsBatchProcessor, TypedKinesisEventBatchProcessor, TypedDynamoDbStreamBatchProcessor
  • Fluent API Builder: BatchProcessorBuilder<TEvent, TRecord> for programmatic configuration
  • Auto-Deserialization: Automatic JSON deserialization from event records to user-defined types

Documentation updates

  • New section in each processor added that explains the new Typed approach.
  • Dedicated section on Typed approach
image

User experience

Introduce strongly-typed batch processing that automatically handles deserialization:

New Interface-based Approach:

public class OrderHandler : ITypedRecordHandler<Order>
{
    public async Task<RecordHandlerResult> HandleAsync(Order order, CancellationToken cancellationToken)
    {
        // Direct access to strongly-typed object - no manual deserialization!
        await ProcessOrder(order);
        return RecordHandlerResult.Successful;
    }
}

Fluent API Builder:

var result = await TypedSqsBatchProcessorBuilder.Create()
    .WithJsonSerializerContext(MyJsonContext.Default)
    .Handler<Order>(async (order, ct) => {
        await ProcessOrder(order);
        return RecordHandlerResult.Successful;
    })
    .ProcessAsync(sqsEvent, context);

Checklist

Please leave checklist items unchecked if they do not apply to your change.

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.

@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Sep 1, 2025
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 1, 2025
@github-actions github-actions bot added the feature New features or minor changes label Sep 1, 2025
Copy link

codecov bot commented Sep 1, 2025

Codecov Report

❌ Patch coverage is 79.37428% with 178 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.65%. Comparing base (e1c72a2) to head (64d0c1f).
⚠️ Report is 19 commits behind head on develop.

Files with missing lines Patch % Lines
...ools.BatchProcessing/Sqs/TypedSqsBatchProcessor.cs 76.47% 25 Missing and 11 partials ⚠️
...sing/DynamoDb/TypedDynamoDbStreamBatchProcessor.cs 71.30% 24 Missing and 9 partials ⚠️
...cessing/Kinesis/TypedKinesisEventBatchProcessor.cs 71.30% 24 Missing and 9 partials ⚠️
...owertools.BatchProcessing/BatchProcessorBuilder.cs 78.90% 25 Missing and 2 partials ⚠️
...BatchProcessing/Internal/ContextInjectionHelper.cs 73.11% 18 Missing and 7 partials ⚠️
...BatchProcessing/Internal/AotCompatibilityHelper.cs 70.90% 14 Missing and 2 partials ⚠️
...ools.BatchProcessing/JsonDeserializationService.cs 90.74% 3 Missing and 2 partials ⚠️
...chProcessing/Kinesis/KinesisRecordDataExtractor.cs 75.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #970      +/-   ##
===========================================
+ Coverage    77.47%   77.65%   +0.18%     
===========================================
  Files          271      288      +17     
  Lines        10886    11749     +863     
  Branches      1284     1402     +118     
===========================================
+ Hits          8434     9124     +690     
- Misses        2040     2172     +132     
- Partials       412      453      +41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

sonarqubecloud bot commented Sep 1, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New features or minor changes size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Add strongly-typed batch processing with automatic deserialization support
1 participant