Skip to content

Added documentation for stream analytics and custom checkpointing event structures #206

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
merged 1 commit into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,44 @@
import java.util.List;
import java.util.Map;

/**
* 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>.
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DynamodbTimeWindowEvent extends DynamodbEvent implements Serializable, Cloneable {

private static final long serialVersionUID = -5449871161108629510L;

/**
* Time window for the records in the event.
*/
private TimeWindow window;

/**
* State being built up to this invoke in the time window.
*/
private Map<String, String> state;

/**
* Shard id of the records
*/
private String shardId;

/**
* Dynamodb stream arn.
*/
private String eventSourceArn;

/**
* Set to true for the last invoke of the time window. Subsequent invoke will start a new time window along with a fresh state.
*/
private Boolean isFinalInvokeForWindow;

/**
* Set to true if window is terminated prematurely. Subsequent invoke will continue the same window with a fresh state.
*/
private Boolean isWindowTerminatedEarly;

@Builder(setterPrefix = "with")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,44 @@
import java.util.List;
import java.util.Map;

/**
* 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>.
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class KinesisTimeWindowEvent extends KinesisEvent implements Serializable, Cloneable {

private static final long serialVersionUID = 8926430039233062266L;

/**
* Time window for the records in the event.
*/
private TimeWindow window;

/**
* State being built up to this invoke in the time window.
*/
private Map<String, String> state;

/**
* Shard id of the records
*/
private String shardId;

/**
* Kinesis stream or consumer arn.
*/
private String eventSourceArn;

/**
* Set to true for the last invoke of the time window. Subsequent invoke will start a new time window along with a fresh state.
*/
private Boolean isFinalInvokeForWindow;

/**
* Set to true if window is terminated prematurely. Subsequent invoke will continue the same window with a fresh state.
*/
private Boolean isWindowTerminatedEarly;

@Builder(setterPrefix = "with")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@
import java.io.Serializable;
import java.util.List;

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

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

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

/**
* Sequence number of the record which failed processing.
*/
String itemIdentifier;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,25 @@
import java.util.List;
import java.util.Map;

/**
* 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}.
* https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder(setterPrefix = "with")
public class TimeWindowEventResponse implements Serializable {
private static final long serialVersionUID = 2259096191791166028L;

/**
* New state after processing a batch of records.
*/
private Map<String, String> state;

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

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

/**
* Sequence number of the record which failed processing.
*/
String itemIdentifier;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,22 @@
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* Represents a time window.
*/
@Data
@Builder(setterPrefix = "with")
@NoArgsConstructor
@AllArgsConstructor
public class TimeWindow {

/**
* Window start instant represented as ISO-8601 string.
*/
private String start;

/**
* Window end instant represented as ISO-8601 string.
*/
private String end;
}