Skip to content

Commit e1d88c2

Browse files
committed
Added new batch processing option: 'ThrowOnFullBatchFailure' to control if a BatchProcessingException should be raised on full batch failure or not.
1 parent 5a483b7 commit e1d88c2

File tree

11 files changed

+449
-150
lines changed

11 files changed

+449
-150
lines changed

examples/BatchProcessing/src/HelloWorld/Function.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,58 +42,58 @@ static Function()
4242
Services.Init();
4343
}
4444

45-
[BatchProcessor(RecordHandler = typeof(CustomDynamoDbStreamRecordHandler))]
4645
[Logging(LogEvent = true)]
46+
[BatchProcessor(RecordHandler = typeof(CustomDynamoDbStreamRecordHandler))]
4747
public BatchItemFailuresResponse DynamoDbStreamHandlerUsingAttribute(DynamoDBEvent _)
4848
{
4949
return DynamoDbStreamBatchProcessor.Result.BatchItemFailuresResponse;
5050
}
51-
52-
[BatchProcessor(RecordHandler = typeof(CustomKinesisEventRecordHandler))]
51+
5352
[Logging(LogEvent = true)]
53+
[BatchProcessor(RecordHandler = typeof(CustomKinesisEventRecordHandler))]
5454
public BatchItemFailuresResponse KinesisEventHandlerUsingAttribute(KinesisEvent _)
5555
{
5656
return KinesisEventBatchProcessor.Result.BatchItemFailuresResponse;
5757
}
5858

59-
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler))]
6059
[Logging(LogEvent = true)]
60+
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler))]
6161
public BatchItemFailuresResponse SqsHandlerUsingAttribute(SQSEvent _)
6262
{
6363
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
6464
}
65-
66-
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), ErrorHandlingPolicy = BatchProcessorErrorHandlingPolicy.StopOnFirstBatchItemFailure)]
65+
6766
[Logging(LogEvent = true)]
67+
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), ErrorHandlingPolicy = BatchProcessorErrorHandlingPolicy.StopOnFirstBatchItemFailure)]
6868
public BatchItemFailuresResponse SqsHandlerUsingAttributeWithErrorPolicy(SQSEvent _)
6969
{
7070
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
7171
}
7272

7373
#region More example handlers...
74-
75-
[BatchProcessor(RecordHandlerProvider = typeof(CustomSqsRecordHandlerProvider), BatchProcessor = typeof(CustomSqsBatchProcessor))]
74+
7675
[Logging(LogEvent = true)]
76+
[BatchProcessor(RecordHandlerProvider = typeof(CustomSqsRecordHandlerProvider), BatchProcessor = typeof(CustomSqsBatchProcessor))]
7777
public BatchItemFailuresResponse HandlerUsingAttributeAndCustomRecordHandlerProvider(SQSEvent _)
7878
{
7979
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
80-
}
81-
82-
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessor = typeof(CustomSqsBatchProcessor))]
80+
}
81+
8382
[Logging(LogEvent = true)]
83+
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessor = typeof(CustomSqsBatchProcessor))]
8484
public BatchItemFailuresResponse HandlerUsingAttributeAndCustomBatchProcessor(SQSEvent _)
8585
{
8686
return SqsBatchProcessor.Result.BatchItemFailuresResponse;
8787
}
88-
89-
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessorProvider = typeof(CustomSqsBatchProcessorProvider))]
88+
9089
[Logging(LogEvent = true)]
90+
[BatchProcessor(RecordHandler = typeof(CustomSqsRecordHandler), BatchProcessorProvider = typeof(CustomSqsBatchProcessorProvider))]
9191
public BatchItemFailuresResponse HandlerUsingAttributeAndCustomBatchProcessorProvider(SQSEvent _)
9292
{
9393
var batchProcessor = Services.Provider.GetRequiredService<ISqsBatchProcessor>();
9494
return batchProcessor.ProcessingResult.BatchItemFailuresResponse;
9595
}
96-
96+
9797
[Logging(LogEvent = true)]
9898
public async Task<BatchItemFailuresResponse> HandlerUsingUtility(SQSEvent sqsEvent)
9999
{
@@ -103,7 +103,7 @@ public async Task<BatchItemFailuresResponse> HandlerUsingUtility(SQSEvent sqsEve
103103
}));
104104
return result.BatchItemFailuresResponse;
105105
}
106-
106+
107107
[Logging(LogEvent = true)]
108108
public async Task<BatchItemFailuresResponse> HandlerUsingUtilityFromIoc(SQSEvent sqsEvent)
109109
{
@@ -112,6 +112,6 @@ public async Task<BatchItemFailuresResponse> HandlerUsingUtilityFromIoc(SQSEvent
112112
var result = await batchProcessor.ProcessAsync(sqsEvent, recordHandler);
113113
return result.BatchItemFailuresResponse;
114114
}
115-
115+
116116
#endregion
117117
}

0 commit comments

Comments
 (0)