T
- Result type returned from the source.public static final class KinesisSources.Builder<T> extends Object
Modifier and Type | Method and Description |
---|---|
StreamSource<T> |
build()
Constructs the source based on the options provided so far.
|
KinesisSources.Builder<T> |
withCredentials(String accessKey,
String secretKey)
Specifies the AWS credentials to use for authentication
purposes.
|
KinesisSources.Builder<T> |
withEndpoint(String endpoint)
Specifies the AWS Kinesis endpoint (URL of the entry point
for the AWS web service) to connect to.
|
KinesisSources.Builder<T> |
withExecutorServiceSupplier(SupplierEx<ExecutorService> executorSupplier)
Specifies an executor service supplier that will be used by the
AwsConfig
to construct an AWS async client. |
KinesisSources.Builder<T> |
withInitialShardIteratorRule(String shardIdRegExp,
String shardIteratorType,
String parameter)
Specifies how initial reads of the shards should be done (see
shardIteratorType for available options).
|
<T_NEW> KinesisSources.Builder<T_NEW> |
withProjectionFn(BiFunctionEx<com.amazonaws.services.kinesis.model.Record,com.amazonaws.services.kinesis.model.Shard,T_NEW> projectionFn)
Specifies projection function, that will map input
Record
and Shard from which this record was read into user-defined type. |
KinesisSources.Builder<T> |
withRegion(String region)
Specifies the AWS Region (collection of AWS resources in a
geographic area) to connect to.
|
KinesisSources.Builder<T> |
withRetryStrategy(RetryStrategy retryStrategy)
Specifies how the source should behave when reading data from
the stream fails.
|
@Nonnull public KinesisSources.Builder<T> withEndpoint(@Nullable String endpoint)
protocol://service-code.region-code.amazonaws.com
",
so for example, for Kinesis, for the us-west-2
region, we could have
"https://dynamodb.us-west-2.amazonaws.com
". For local
testing, it might be "http://localhost:4566
".
If not specified (or specified as null
), the default
endpoint for the specified region will be used.
@Nonnull public KinesisSources.Builder<T> withRegion(@Nullable String region)
us-west-1
", "eu-central-1
" and so on.
If not specified (or specified as null
), the default
region set via external means will be used (either from your
local .aws/config
file or the AWS_REGION
environment variable). If no such default is set, then
"us-east-1
" will be used.
@Nonnull public KinesisSources.Builder<T> withCredentials(@Nullable String accessKey, @Nullable String secretKey)
If not specified (or specified as null
), then keys
specified via external means will be used. This can mean the
local .aws/credentials
file or the
AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
environmental variables.
Either both keys must be set to non-null values or neither.
@Nonnull public KinesisSources.Builder<T> withRetryStrategy(@Nonnull RetryStrategy retryStrategy)
@Nonnull public KinesisSources.Builder<T> withInitialShardIteratorRule(@Nonnull String shardIdRegExp, @Nonnull String shardIteratorType, @Nullable String parameter)
Each call of this method registers one rule which applies to
any number of shards, depending on the shardIdRegExp
matching the shard's id or not. The syntax of regular
expressions is as defined by java.util.regex.Pattern
.
The method can be called any number of times, the rules will
be evaluated in the order they have been registered. Only the
first rule that matches a shard will be applied for that
shard.
Type of rules allowed, together with their meaning, are:
Depending on the rule specified the optional
parameter must also be specified. For
AT_TIMESTAMP it needs to be a timestamp in the Unix
epoch date format, with millisecond precision. For
AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER it
must be a sequence number accepted by KDS. For other types it
must be left null
.
NOTE: The AT_TIMESTAMP version, even though supported by Kinesis, doesn't currently work properly. This is due to be a bug in AWS SDK v1, used by the source. AWS SDK v2 fixes the problem and hopefully this source will be switched to using that in future Jet releases.
@Nonnull public <T_NEW> KinesisSources.Builder<T_NEW> withProjectionFn(@Nonnull BiFunctionEx<com.amazonaws.services.kinesis.model.Record,com.amazonaws.services.kinesis.model.Shard,T_NEW> projectionFn)
Record
and Shard
from which this record was read into user-defined type.
If not provided, source will return Map.Entry<String, byte[]>
with Record.getPartitionKey()
as key and Record.getData()
as value.@Nonnull public KinesisSources.Builder<T> withExecutorServiceSupplier(@Nonnull SupplierEx<ExecutorService> executorSupplier)
AwsConfig
to construct an AWS async client.@Nonnull public StreamSource<T> build()
Copyright © 2022 Hazelcast, Inc.. All rights reserved.