-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new StreamsEventResponse class for reporting batch item failure…
…s when processing streams for KinesisEvent.
- Loading branch information
1 parent
0e62fe1
commit 5737503
Showing
6 changed files
with
113 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Libraries/src/Amazon.Lambda.KinesisEvents/StreamsEventResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace Amazon.Lambda.KinesisEvents | ||
{ | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
/// <summary> | ||
/// Function response type to report batch item failures for KinesisEvent. | ||
/// https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-batchfailurereporting | ||
/// </summary> | ||
[DataContract] | ||
public class StreamsEventResponse | ||
{ | ||
/// <summary> | ||
/// A list of records which failed processing. Returning the first record which failed would retry all remaining records from the batch. | ||
/// </summary> | ||
[DataMember(Name = "batchItemFailures", EmitDefaultValue = false)] | ||
#if NETCOREAPP3_1 | ||
[System.Text.Json.Serialization.JsonPropertyName("batchItemFailures")] | ||
#endif | ||
public IList<BatchItemFailure> BatchItemFailures { get; set; } | ||
|
||
/// <summary> | ||
/// The class representing the BatchItemFailure. | ||
/// </summary> | ||
[DataContract] | ||
public class BatchItemFailure | ||
{ | ||
/// <summary> | ||
/// Sequence number of the record which failed processing. | ||
/// </summary> | ||
[DataMember(Name = "itemIdentifier", EmitDefaultValue = false)] | ||
#if NETCOREAPP3_1 | ||
[System.Text.Json.Serialization.JsonPropertyName("itemIdentifier")] | ||
#endif | ||
public string ItemIdentifier { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Libraries/test/EventsTests.Shared/kinesis-batchitemfailures-response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"batchItemFailures": [ | ||
{ | ||
"itemIdentifier": "1405400000000002063282832" | ||
} | ||
] | ||
} |