Skip to content

feat: New batch processing option: 'ThrowOnFullBatchFailure' #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions examples/BatchProcessing/src/HelloWorld/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,58 +42,58 @@ static Function()
Services.Init();
}

[BatchProcessor(RecordHandler = typeof(CustomDynamoDbStreamRecordHandler))]
[Logging(LogEvent = true)]
[BatchProcessor(RecordHandler = typeof(CustomDynamoDbStreamRecordHandler))]
public BatchItemFailuresResponse DynamoDbStreamHandlerUsingAttribute(DynamoDBEvent _)
{
return DynamoDbStreamBatchProcessor.Result.BatchItemFailuresResponse;
}

[BatchProcessor(RecordHandler = typeof(CustomKinesisEventRecordHandler))]

[Logging(LogEvent = true)]
[BatchProcessor(RecordHandler = typeof(CustomKinesisEventRecordHandler))]
public BatchItemFailuresResponse KinesisEventHandlerUsingAttribute(KinesisEvent _)
{
return KinesisEventBatchProcessor.Result.BatchItemFailuresResponse;
}

[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler))]
[Logging(LogEvent = true)]
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler))]
public BatchItemFailuresResponse SqsHandlerUsingAttribute(SQSEvent _)
{
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
}

[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), ErrorHandlingPolicy = BatchProcessorErrorHandlingPolicy.StopOnFirstBatchItemFailure)]

[Logging(LogEvent = true)]
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), ErrorHandlingPolicy = BatchProcessorErrorHandlingPolicy.StopOnFirstBatchItemFailure)]
public BatchItemFailuresResponse SqsHandlerUsingAttributeWithErrorPolicy(SQSEvent _)
{
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
}

#region More example handlers...

[BatchProcessor(RecordHandlerProvider = typeof(CustomSqsRecordHandlerProvider), BatchProcessor = typeof(CustomSqsBatchProcessor))]

[Logging(LogEvent = true)]
[BatchProcessor(RecordHandlerProvider = typeof(CustomSqsRecordHandlerProvider), BatchProcessor = typeof(CustomSqsBatchProcessor))]
public BatchItemFailuresResponse HandlerUsingAttributeAndCustomRecordHandlerProvider(SQSEvent _)
{
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
}

[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessor = typeof(CustomSqsBatchProcessor))]
}

[Logging(LogEvent = true)]
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessor = typeof(CustomSqsBatchProcessor))]
public BatchItemFailuresResponse HandlerUsingAttributeAndCustomBatchProcessor(SQSEvent _)
{
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
}

[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessorProvider = typeof(CustomSqsBatchProcessorProvider))]

[Logging(LogEvent = true)]
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessorProvider = typeof(CustomSqsBatchProcessorProvider))]
public BatchItemFailuresResponse HandlerUsingAttributeAndCustomBatchProcessorProvider(SQSEvent _)
{
var batchProcessor = Services.Provider.GetRequiredService<ISqsBatchProcessor>();
return batchProcessor.ProcessingResult.BatchItemFailuresResponse;
}

[Logging(LogEvent = true)]
public async Task<BatchItemFailuresResponse> HandlerUsingUtility(SQSEvent sqsEvent)
{
Expand All @@ -103,7 +103,7 @@ public async Task<BatchItemFailuresResponse> HandlerUsingUtility(SQSEvent sqsEve
}));
return result.BatchItemFailuresResponse;
}

[Logging(LogEvent = true)]
public async Task<BatchItemFailuresResponse> HandlerUsingUtilityFromIoc(SQSEvent sqsEvent)
{
Expand All @@ -112,6 +112,6 @@ public async Task<BatchItemFailuresResponse> HandlerUsingUtilityFromIoc(SQSEvent
var result = await batchProcessor.ProcessAsync(sqsEvent, recordHandler);
return result.BatchItemFailuresResponse;
}

#endregion
}
Loading
Loading