Amazon Kinesis Stream with AWS SDK for Java: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 7: Line 7:


* [[Amazon_Kinesis_Streams#Amazon_Kinesis_Stream_with_AWS_SDK_for_Java|Amazon Kinesis Streams]]
* [[Amazon_Kinesis_Streams#Amazon_Kinesis_Stream_with_AWS_SDK_for_Java|Amazon Kinesis Streams]]
* [[AWS_SDK_for_Java#Overview|AWS SDK for Java]]
* [[AWS_SDK_for_Java_Version_2#Component_APIs|AWS SDK for Java Version 2]]
* [[AWS_SDK_for_Java_Version_1#Component_APIs_that_Use_SDK_for_Java_Version_1|AWS SDK for Java Version 1]]


=Overview=
=Overview=
Relevant Amazon Kinesis Stream concepts: [[Amazon_Kinesis#Stream_Name|stream name]], [[Amazon_Kinesis#Partition_Key|partition key]], [[Amazon_Kinesis#Sequence_Number|sequence number]].


=Dependency=
=Dependency=
<font color=darkgray>TODO: Gradle dependencies for ASW SDK for Java 2 look differently: https://kb.novaordis.com/index.php/AWS_SDK_for_Java_Version_2#Gradle_Project
TODO: Gradle dependencies for ASW SDK for Java 1 look differently: https://kb.novaordis.com/index.php/AWS_SDK_for_Java_Version_1#Gradle_Project</font>
<syntaxhighlight lang='groovy'>
<syntaxhighlight lang='groovy'>
dependencies {
dependencies {
Line 18: Line 24:
</syntaxhighlight>
</syntaxhighlight>


=Playground Example=
=Developing Stream Consumers=
 
{{External|https://docs.aws.amazon.com/streams/latest/dev/developing-consumers-with-sdk.html}}
 
{{External|[https://github.com/ovidiuf/playground/tree/master/amazon/kinesis/streams/02-get-records Playground Example - Consumer with a TRIM_HORIZON Shard Iterator]}}
{{External|[https://github.com/ovidiuf/playground/tree/master/amazon/kinesis/streams/02.1-get-records-latest-shard-iterator Playground Example - Consumer with a LATEST Shard Iterator]}}
 
Kinesis consumers developed with AWS SDK for Java use a pull model, where the client polls the stream. [[Amazon_Kinesis_Stream_with_Kinesis_Client_Library#Overview|Kinesis Client Library (KCL)]] on the other hand, uses a push model, which is more efficient. In addition, KCL provides failover, recovery and load balancing functionality.
 
=<span id='Playground_Example'></span><span id='Playground_Examples'></span>Developing Stream Producers=


=Put a Record=
{{External|[https://github.com/ovidiuf/playground/tree/master/amazon/kinesis/streams/01-put-record Playground Example - Record Producer]}}

Latest revision as of 05:42, 3 October 2021

External

Internal

Overview

Relevant Amazon Kinesis Stream concepts: stream name, partition key, sequence number.

Dependency

TODO: Gradle dependencies for ASW SDK for Java 2 look differently: https://kb.novaordis.com/index.php/AWS_SDK_for_Java_Version_2#Gradle_Project

TODO: Gradle dependencies for ASW SDK for Java 1 look differently: https://kb.novaordis.com/index.php/AWS_SDK_for_Java_Version_1#Gradle_Project

dependencies {
    implementation 'com.amazonaws:aws-java-sdk-kinesis:1.11.471'
}

Developing Stream Consumers

https://docs.aws.amazon.com/streams/latest/dev/developing-consumers-with-sdk.html
Playground Example - Consumer with a TRIM_HORIZON Shard Iterator
Playground Example - Consumer with a LATEST Shard Iterator

Kinesis consumers developed with AWS SDK for Java use a pull model, where the client polls the stream. Kinesis Client Library (KCL) on the other hand, uses a push model, which is more efficient. In addition, KCL provides failover, recovery and load balancing functionality.

Developing Stream Producers

Playground Example - Record Producer