Skip to content

Commit cb45813

Browse files
authored
Merge pull request #89 from sahilpalvia/fanout-support
Introducing Enhanced Fan-Out with amazon_kclpy
2 parents af66df0 + 544af7f commit cb45813

19 files changed

+615
-152
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/build/
66
/dist/
77
/docs/_build/
8+
/.eggs/
89

910
# IntelliJ idea stuff
1011
.idea

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ typically looks something like:
1818

1919
class RecordProcessor(kcl.RecordProcessorBase):
2020

21-
def initialize(self, shard_id):
21+
def initialize(self, initialiation_input):
2222
pass
2323

24-
def process_records(self, records, checkpointer):
24+
def process_records(self, process_records_input):
2525
pass
2626

27-
def shutdown(self, checkpointer, reason):
27+
def lease_lost(self, lease_lost_input):
28+
pass
29+
30+
def shard_ended(self, shard_ended_input):
31+
pass
32+
33+
def shutdown_requested(self, shutdown_requested_input):
2834
pass
2935

3036
if __name__ == "__main__":
@@ -38,7 +44,7 @@ Before running the samples, you'll want to make sure that your environment is
3844
configured to allow the samples to use your
3945
[AWS Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
4046

41-
By default the samples use the [DefaultAWSCredentialsProviderChain][DefaultAWSCredentialsProviderChain]
47+
By default the samples use the [DefaultCredentialsProvider][DefaultCredentialsProvider]
4248
so you'll want to make your credentials available to one of the credentials providers in that
4349
provider chain. There are several ways to do this such as providing a ~/.aws/credentials file,
4450
or if you're running on EC2, you can associate an IAM role with your instance with appropriate
@@ -138,6 +144,22 @@ all languages.
138144

139145
## Release Notes
140146

147+
### Release 2.0.0 (January 15, 2019)
148+
* Introducing support for Enhanced Fan-Out
149+
* Updated to version 2.1.0 of the Amazon Kinesis Client for Java
150+
* Version 2.1.0 now defaults to using [`RegisterStreamConsumer` Kinesis API](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_RegisterStreamConsumer.html), which provides dedicated throughput compared to `GetRecords`.
151+
* Version 2.1.0 now defaults to using [`SubscribeToShard` Kinesis API](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_SubscribeToShard.html), which provides lower latencies than `GetRecords`.
152+
* __WARNING: `RegisterStreamConsumer` and `SubscribeToShard` are new APIs, and may require updating any explicit IAM policies__
153+
* For more information about Enhaced Fan-Out and Polling with the KCL check out the [announcement](https://aws.amazon.com/blogs/aws/kds-enhanced-fanout/) and [developer documentation](https://docs.aws.amazon.com/streams/latest/dev/introduction-to-enhanced-consumers.html).
154+
* Introducing version 3 of the `RecordProcessorBase` which supports the new `ShardRecordProcessor` interface
155+
* The `shutdown` method from version 2 has been removed and replaced by `leaseLost` and `shardEnded` methods.
156+
* Introducing `leaseLost` method, which takes `LeaseLostInput` object and is invoked when a lease is lost.
157+
* Introducing `shardEnded` method, which takes `ShardEndedInput` object and is invoked when all records from a split/merge have been processed.
158+
* Updated AWS SDK version to 2.2.0
159+
* MultiLangDaemon now uses logging using logback
160+
* MultiLangDaemon supports custom logback.xml file via the `--log-configuration` option.
161+
* `amazon_kclpy_helper` script supports `--log-configuration` option for command generation.
162+
141163
### Release 1.5.1 (January 2, 2019)
142164
* Updated to version 1.9.3 of the Amazon Kinesis Client Library for Java.
143165
* [PR #87](https://github.com/awslabs/amazon-kinesis-client-python/pull/87)
@@ -215,5 +237,5 @@ all languages.
215237
[amazon-kinesis-ruby-github]: https://github.com/awslabs/amazon-kinesis-client-ruby
216238
[kinesis-github]: https://github.com/awslabs/amazon-kinesis-client
217239
[boto]: http://boto.readthedocs.org/en/latest/
218-
[DefaultAWSCredentialsProviderChain]: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html
240+
[DefaultCredentialsProvider]: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/auth/credentials/DefaultCredentialsProvider.html
219241
[kinesis-forum]: http://developer.amazonwebservices.com/connect/forum.jspa?forumID=169

amazon_kclpy/checkpoint_error.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Amazon Software License (the "License").
4+
# You may not use this file except in compliance with the License.
5+
# A copy of the License is located at
6+
#
7+
# http://aws.amazon.com/asl/
8+
#
9+
# or in the "license" file accompanying this file. This file is distributed
10+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
# express or implied. See the License for the specific language governing
12+
# permissions and limitations under the License.
13+
14+
class CheckpointError(Exception):
15+
"""
16+
Error class used for wrapping exception names passed through the input file.
17+
"""
18+
def __init__(self, value):
19+
"""
20+
:type value: str
21+
:param value: The name of the exception that was received while checkpointing. For more details see
22+
https://github.com/awslabs/amazon-kinesis-client/tree/master/src/main/java/com/amazonaws/services/kinesis/clientlibrary/exceptions
23+
Any of those exceptions' names could be returned by the MultiLangDaemon as a response to a checkpoint action.
24+
"""
25+
self.value = value
26+
27+
def __str__(self):
28+
return repr(self.value)
29+

amazon_kclpy/dispatch.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Amazon Software License (the "License").
44
# You may not use this file except in compliance with the License.
@@ -10,6 +10,7 @@
1010
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
1111
# express or implied. See the License for the specific language governing
1212
# permissions and limitations under the License.
13+
1314
from amazon_kclpy import messages
1415

1516

@@ -26,7 +27,9 @@ class MalformedAction(Exception):
2627
"shutdown": messages.ShutdownInput,
2728
"checkpoint": messages.CheckpointInput,
2829
"record": messages.Record,
29-
"shutdownRequested": messages.ShutdownRequestedInput
30+
"shutdownRequested": messages.ShutdownRequestedInput,
31+
"leaseLost": messages.LeaseLostInput,
32+
"shardEnded": messages.ShardEndedInput,
3033
}
3134

3235

0 commit comments

Comments
 (0)