@Experimental public final class KinesisIO extends java.lang.Object
PTransforms for reading from
Kinesis streams.
Example usage:
p.apply(KinesisIO.read()
.from("streamName", InitialPositionInStream.LATEST)
.withClientProvider("AWS_KEY", _"AWS_SECRET", STREAM_REGION)
.apply( ... ) // other transformations
As you can see you need to provide 3 things:
InitialPositionInStream.LATEST - reading will begin from end of the streamInitialPositionInStream.TRIM_HORIZON - reading will begin at
the very beginning of the streamAmazonKinesis client:
In case when you want to set up AmazonKinesis client by your own
(for example if you're using more sophisticated authorization methods like Amazon STS, etc.)
you can do it by implementing KinesisClientProvider class:
public class MyCustomKinesisClientProvider implements KinesisClientProvider {
{@literal @}Override
public AmazonKinesis get() {
// set up your client here
}
}
Usage is pretty straightforward:
p.apply(KinesisIO.read()
.from("streamName", InitialPositionInStream.LATEST)
.withClientProvider(new MyCustomKinesisClientProvider())
.apply( ... ) // other transformations
There’s also possibility to start reading using arbitrary point in time -
in this case you need to provide Instant object:
p.apply(KinesisIO.read()
.from("streamName", instant)
.withClientProvider(new MyCustomKinesisClientProvider())
.apply( ... ) // other transformations
| Modifier and Type | Class and Description |
|---|---|
static class |
KinesisIO.Read
Implementation of
read(). |
| Constructor and Description |
|---|
KinesisIO() |
| Modifier and Type | Method and Description |
|---|---|
static KinesisIO.Read |
read()
Returns a new
KinesisIO.Read transform for reading from Kinesis. |
public static KinesisIO.Read read()
KinesisIO.Read transform for reading from Kinesis.