[SPARK-31236][DSTREAMS][Kinesis] KCL 2 support added to solve few ongoing issue with KCL 1 implementation #28581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Currently KCL 1 is no longer supported by AWS and they already moved to KCL 2. Since Spark kinesis asl library user KCL 1 it can cause issues reported by AWS for KCL 1. awslabs/amazon-kinesis-client#391
The issue I have already reported in JIRA
https://issues.apache.org/jira/browse/SPARK-31236
Why are the changes needed?
Added KCL 2 support. Did not remove KCL 1. With current KCL 1 implementation the user can run into few limitation
Application cannot run without internet connection or firewall restrictions.
Does this PR introduce any user-facing change?
Added KCL 2 support. Did not remove KCL 1. With current KCL 1 implementation the user can run into few limitation
Application cannot run without internet connection or firewall restrictions.
How was this patch tested?
Tested with our application and test client updated with KCL 2 testing.
import org.apache.spark.streaming.kinesis2.KinesisInputDStream;
import org.apache.spark.streaming.kinesis2.SparkAWSCredentials;
SparkAWSCredentials credentials = SparkAWSCredentials.builder().basicCredentials(awsKey, awsSecret).build();
URI uri = new URI(endpointURL);
URI cloudWatchURI = new URI(cloudWatchURL);
InitialPositionInStream initPosition = InitialPositionInStream.TRIM_HORIZON;
KinesisInputDStream<byte[]> kinStream =KinesisInputDStream.builder()
.streamingContext(jssc)
.checkpointAppName(applicationName)
.streamName(streamName)
.regionName(regionName)
.endpointUrl(uri)
.cloudWatchUrl(cloudWatchURI)
.kinesisCreds(credentials)
.dynamoDBCreds(credentials)
.maxRecords(maxRecords)
.protocol(httpProtocol)
.initialPositionInStream(initPosition)
.cloudWatchCreds(credentials)
.dynamoProxyHost(proxyHost)
.dynamoProxyPort(proxyPort)
.checkpointInterval(checkpointInterval)
.storageLevel(StorageLevel.MEMORY_AND_DISK_2()).build();