Skip to content

Commit 282c01d

Browse files
authored
New events structures for StreamAnalytics and CustomCheckpointing (#202)
1 parent c247f11 commit 282c01d

File tree

5 files changed

+228
-0
lines changed

5 files changed

+228
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5+
* the License. A copy of the License is located at
6+
*
7+
* http://aws.amazon.com/apache2.0
8+
*
9+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11+
* and limitations under the License.
12+
*/
13+
14+
package com.amazonaws.services.lambda.runtime.events;
15+
16+
import com.amazonaws.services.lambda.runtime.events.models.TimeWindow;
17+
import lombok.Builder;
18+
import lombok.Data;
19+
import lombok.EqualsAndHashCode;
20+
import lombok.NoArgsConstructor;
21+
22+
import java.io.Serializable;
23+
import java.util.List;
24+
import java.util.Map;
25+
26+
@Data
27+
@NoArgsConstructor
28+
@EqualsAndHashCode(callSuper = true)
29+
public class DynamodbTimeWindowEvent extends DynamodbEvent implements Serializable, Cloneable {
30+
31+
private static final long serialVersionUID = -5449871161108629510L;
32+
33+
private TimeWindow window;
34+
private Map<String, String> state;
35+
private String shardId;
36+
private String eventSourceArn;
37+
private Boolean isFinalInvokeForWindow;
38+
private Boolean isWindowTerminatedEarly;
39+
40+
@Builder(setterPrefix = "with")
41+
public DynamodbTimeWindowEvent(
42+
final List<DynamodbStreamRecord> records,
43+
final TimeWindow window,
44+
final Map<String, String> state,
45+
final String shardId,
46+
final String eventSourceArn,
47+
final Boolean isFinalInvokeForWindow,
48+
final Boolean isWindowTerminatedEarly) {
49+
this.setRecords(records);
50+
this.window = window;
51+
this.state = state;
52+
this.shardId = shardId;
53+
this.eventSourceArn = eventSourceArn;
54+
this.isFinalInvokeForWindow = isFinalInvokeForWindow;
55+
this.isWindowTerminatedEarly = isWindowTerminatedEarly;
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5+
* the License. A copy of the License is located at
6+
*
7+
* http://aws.amazon.com/apache2.0
8+
*
9+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11+
* and limitations under the License.
12+
*/
13+
14+
package com.amazonaws.services.lambda.runtime.events;
15+
16+
import com.amazonaws.services.lambda.runtime.events.models.TimeWindow;
17+
import lombok.Builder;
18+
import lombok.Data;
19+
import lombok.EqualsAndHashCode;
20+
import lombok.NoArgsConstructor;
21+
22+
import java.io.Serializable;
23+
import java.util.List;
24+
import java.util.Map;
25+
26+
@Data
27+
@NoArgsConstructor
28+
@EqualsAndHashCode(callSuper = true)
29+
public class KinesisTimeWindowEvent extends KinesisEvent implements Serializable, Cloneable {
30+
31+
private static final long serialVersionUID = 8926430039233062266L;
32+
33+
private TimeWindow window;
34+
private Map<String, String> state;
35+
private String shardId;
36+
private String eventSourceArn;
37+
private Boolean isFinalInvokeForWindow;
38+
private Boolean isWindowTerminatedEarly;
39+
40+
@Builder(setterPrefix = "with")
41+
public KinesisTimeWindowEvent(
42+
final List<KinesisEventRecord> records,
43+
final TimeWindow window,
44+
final Map<String, String> state,
45+
final String shardId,
46+
final String eventSourceArn,
47+
final Boolean isFinalInvokeForWindow,
48+
final Boolean isWindowTerminatedEarly) {
49+
this.setRecords(records);
50+
this.window = window;
51+
this.state = state;
52+
this.shardId = shardId;
53+
this.eventSourceArn = eventSourceArn;
54+
this.isFinalInvokeForWindow = isFinalInvokeForWindow;
55+
this.isWindowTerminatedEarly = isWindowTerminatedEarly;
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5+
* the License. A copy of the License is located at
6+
*
7+
* http://aws.amazon.com/apache2.0
8+
*
9+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11+
* and limitations under the License.
12+
*/
13+
14+
package com.amazonaws.services.lambda.runtime.events;
15+
16+
import lombok.AllArgsConstructor;
17+
import lombok.Builder;
18+
import lombok.Data;
19+
import lombok.NoArgsConstructor;
20+
21+
import java.io.Serializable;
22+
import java.util.List;
23+
24+
@Data
25+
@NoArgsConstructor
26+
@AllArgsConstructor
27+
@Builder(setterPrefix = "with")
28+
public class StreamsEventResponse implements Serializable {
29+
private static final long serialVersionUID = 3232053116472095907L;
30+
31+
private List<BatchItemFailure> batchItemFailures;
32+
33+
@Data
34+
@NoArgsConstructor
35+
@AllArgsConstructor
36+
@Builder(setterPrefix = "with")
37+
public static class BatchItemFailure implements Serializable {
38+
private static final long serialVersionUID = 1473983466096085881L;
39+
40+
String itemIdentifier;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5+
* the License. A copy of the License is located at
6+
*
7+
* http://aws.amazon.com/apache2.0
8+
*
9+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11+
* and limitations under the License.
12+
*/
13+
14+
package com.amazonaws.services.lambda.runtime.events;
15+
16+
import lombok.AllArgsConstructor;
17+
import lombok.Builder;
18+
import lombok.Data;
19+
import lombok.NoArgsConstructor;
20+
21+
import java.io.Serializable;
22+
import java.util.List;
23+
import java.util.Map;
24+
25+
@Data
26+
@NoArgsConstructor
27+
@AllArgsConstructor
28+
@Builder(setterPrefix = "with")
29+
public class TimeWindowEventResponse implements Serializable {
30+
private static final long serialVersionUID = 2259096191791166028L;
31+
32+
private Map<String, String> state;
33+
private List<BatchItemFailure> batchItemFailures;
34+
35+
@Data
36+
@NoArgsConstructor
37+
@AllArgsConstructor
38+
@Builder(setterPrefix = "with")
39+
public static class BatchItemFailure implements Serializable {
40+
private static final long serialVersionUID = 5224634072234167773L;
41+
42+
String itemIdentifier;
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5+
* the License. A copy of the License is located at
6+
*
7+
* http://aws.amazon.com/apache2.0
8+
*
9+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11+
* and limitations under the License.
12+
*/
13+
14+
package com.amazonaws.services.lambda.runtime.events.models;
15+
16+
import lombok.AllArgsConstructor;
17+
import lombok.Builder;
18+
import lombok.Data;
19+
import lombok.NoArgsConstructor;
20+
21+
@Data
22+
@Builder(setterPrefix = "with")
23+
@NoArgsConstructor
24+
@AllArgsConstructor
25+
public class TimeWindow {
26+
private String start;
27+
private String end;
28+
}

0 commit comments

Comments
 (0)