Skip to content

Commit 593e603

Browse files
vinayaksoodVinayak
and
Vinayak
authored
Added documentation for stream analytics and custom checkpointing event structures (#206)
cr https://code.amazon.com/reviews/CR-41217330 Co-authored-by: Vinayak <vinayaks@amazon.com>
1 parent d3653f4 commit 593e603

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/DynamodbTimeWindowEvent.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,44 @@
2323
import java.util.List;
2424
import java.util.Map;
2525

26+
/**
27+
* Represents an Amazon Dynamodb event when using <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows">time windows</a>.
28+
*/
2629
@Data
2730
@NoArgsConstructor
2831
@EqualsAndHashCode(callSuper = true)
2932
public class DynamodbTimeWindowEvent extends DynamodbEvent implements Serializable, Cloneable {
3033

3134
private static final long serialVersionUID = -5449871161108629510L;
3235

36+
/**
37+
* Time window for the records in the event.
38+
*/
3339
private TimeWindow window;
40+
41+
/**
42+
* State being built up to this invoke in the time window.
43+
*/
3444
private Map<String, String> state;
45+
46+
/**
47+
* Shard id of the records
48+
*/
3549
private String shardId;
50+
51+
/**
52+
* Dynamodb stream arn.
53+
*/
3654
private String eventSourceArn;
55+
56+
/**
57+
* Set to true for the last invoke of the time window. Subsequent invoke will start a new time window along with a fresh state.
58+
*/
3759
private Boolean isFinalInvokeForWindow;
60+
61+
/**
62+
* Set to true if window is terminated prematurely. Subsequent invoke will continue the same window with a fresh state.
63+
*/
3864
private Boolean isWindowTerminatedEarly;
3965

4066
@Builder(setterPrefix = "with")

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisTimeWindowEvent.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,44 @@
2323
import java.util.List;
2424
import java.util.Map;
2525

26+
/**
27+
* Represents an Amazon Kinesis event when using <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows">time windows</a>.
28+
*/
2629
@Data
2730
@NoArgsConstructor
2831
@EqualsAndHashCode(callSuper = true)
2932
public class KinesisTimeWindowEvent extends KinesisEvent implements Serializable, Cloneable {
3033

3134
private static final long serialVersionUID = 8926430039233062266L;
3235

36+
/**
37+
* Time window for the records in the event.
38+
*/
3339
private TimeWindow window;
40+
41+
/**
42+
* State being built up to this invoke in the time window.
43+
*/
3444
private Map<String, String> state;
45+
46+
/**
47+
* Shard id of the records
48+
*/
3549
private String shardId;
50+
51+
/**
52+
* Kinesis stream or consumer arn.
53+
*/
3654
private String eventSourceArn;
55+
56+
/**
57+
* Set to true for the last invoke of the time window. Subsequent invoke will start a new time window along with a fresh state.
58+
*/
3759
private Boolean isFinalInvokeForWindow;
60+
61+
/**
62+
* Set to true if window is terminated prematurely. Subsequent invoke will continue the same window with a fresh state.
63+
*/
3864
private Boolean isWindowTerminatedEarly;
3965

4066
@Builder(setterPrefix = "with")

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/StreamsEventResponse.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@
2121
import java.io.Serializable;
2222
import java.util.List;
2323

24+
/**
25+
* Function response type to report batch item failures for {@link KinesisEvent} and {@link DynamodbEvent}.
26+
* https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-batchfailurereporting
27+
*/
2428
@Data
2529
@NoArgsConstructor
2630
@AllArgsConstructor
2731
@Builder(setterPrefix = "with")
2832
public class StreamsEventResponse implements Serializable {
2933
private static final long serialVersionUID = 3232053116472095907L;
3034

35+
/**
36+
* A list of records which failed processing. Returning the first record which failed would retry all remaining records from the batch.
37+
*/
3138
private List<BatchItemFailure> batchItemFailures;
3239

3340
@Data
@@ -37,6 +44,9 @@ public class StreamsEventResponse implements Serializable {
3744
public static class BatchItemFailure implements Serializable {
3845
private static final long serialVersionUID = 1473983466096085881L;
3946

47+
/**
48+
* Sequence number of the record which failed processing.
49+
*/
4050
String itemIdentifier;
4151
}
4252
}

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindowEventResponse.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,25 @@
2222
import java.util.List;
2323
import java.util.Map;
2424

25+
/**
26+
* Response type to return a new state for the time window and to report batch item failures. This should be used along with {@link KinesisTimeWindowEvent} or {@link DynamodbTimeWindowEvent}.
27+
* https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows
28+
*/
2529
@Data
2630
@NoArgsConstructor
2731
@AllArgsConstructor
2832
@Builder(setterPrefix = "with")
2933
public class TimeWindowEventResponse implements Serializable {
3034
private static final long serialVersionUID = 2259096191791166028L;
3135

36+
/**
37+
* New state after processing a batch of records.
38+
*/
3239
private Map<String, String> state;
40+
41+
/**
42+
* A list of records which failed processing. Returning the first record which failed would retry all remaining records from the batch.
43+
*/
3344
private List<BatchItemFailure> batchItemFailures;
3445

3546
@Data
@@ -39,6 +50,9 @@ public class TimeWindowEventResponse implements Serializable {
3950
public static class BatchItemFailure implements Serializable {
4051
private static final long serialVersionUID = 5224634072234167773L;
4152

53+
/**
54+
* Sequence number of the record which failed processing.
55+
*/
4256
String itemIdentifier;
4357
}
4458
}

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/models/TimeWindow.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,22 @@
1818
import lombok.Data;
1919
import lombok.NoArgsConstructor;
2020

21+
/**
22+
* Represents a time window.
23+
*/
2124
@Data
2225
@Builder(setterPrefix = "with")
2326
@NoArgsConstructor
2427
@AllArgsConstructor
2528
public class TimeWindow {
29+
30+
/**
31+
* Window start instant represented as ISO-8601 string.
32+
*/
2633
private String start;
34+
35+
/**
36+
* Window end instant represented as ISO-8601 string.
37+
*/
2738
private String end;
2839
}

0 commit comments

Comments
 (0)