Package com.adaptris.aws2.kinesis
Class KinesisSDKStreamProducer
java.lang.Object
com.adaptris.core.AdaptrisMessageWorkerImp
com.adaptris.core.AdaptrisMessageProducerImp
com.adaptris.core.ProduceOnlyProducerImp
com.adaptris.aws2.kinesis.KinesisSDKStreamProducer
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisMessageProducer,AdaptrisMessageSender,AdaptrisMessageWorker,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator
@ComponentProfile(summary="Produce to Amazon Kinesis using the SDK",
tag="amazon,aws,kinesis,producer",
recommended=AWSKinesisSDKConnection.class)
public class KinesisSDKStreamProducer
extends ProduceOnlyProducerImp
Producer to amazon kinesis using the SDK.
This may be the preferred approach over using KPL if you're running in environment where you don't want other processes to be spawned (for example: containerised).
In the adapter configuration file this class is aliased as aws-kinesis-sdk-stream-producer which is the preferred alternative to the fully qualified classname when building your configuration.
-
Field Summary
FieldsFields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoProduce(AdaptrisMessage msg, String endpoint) protected voiddoSend(software.amazon.awssdk.services.kinesis.KinesisClient kinesisClient, String endpoint, List<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry> putRecordsRequestEntryList) endpoint(AdaptrisMessage msg) Batch window controls on how the records are put to the stream, this used in conjunction with a splitting implementation of the request builder.booleanToggles whether to create the stream if it does not exist at the time of sendinglonglongThe kinesis partition key.Request Builder enables the control on how the records are put, this is used in conjunction with batchWindow.intIf creating a stream, this specifies the number of shards for StreamMode.PROVISIONED.The kinesis stream name.voidprepare()voidsetBatchWindow(Integer batchWindow) Batch window controls on how the records are put to the stream, this used in conjunction with a splitting implementation of the request builder.voidsetCreateIfNotExists(boolean createIfNotExists) Toggles whether to create the stream if it does not exist at the time of sendingvoidsetCreateStreamMaxWaitTimeMillis(long createStreamMaxWaitTimeMillis) voidsetCreateStreamPollTimeMillis(long createStreamPollTimeMillis) voidsetPartitionKey(String partitionKey) voidsetRequestBuilder(RequestBuilder requestBuilder) Request Builder enables the control on how the records are put, this is used in conjunction with batchWindow.voidsetShardCount(int shardCount) If creating a stream, this specifies the number of shards for StreamMode.PROVISIONED.voidThe kinesis stream name.<T extends KinesisSDKStreamProducer>
T<T extends KinesisSDKStreamProducer>
TwithCreateIfNotExists(boolean createIfNotExists) <T extends KinesisSDKStreamProducer>
TwithCreateStreamMaxWaitTimeMillis(long millis) If createIfNotExists is true, when creating the stream, this is the max wait time for the stream to become active<T extends KinesisSDKStreamProducer>
TwithCreateStreamPollTimeMillis(long millis) If createIfNotExists is true, when creating the stream, this is the wait time between polling to check if the stream is active<T extends KinesisSDKStreamProducer>
T<T extends KinesisSDKStreamProducer>
T<T extends KinesisSDKStreamProducer>
TwithShardCount(int shardCount) If createIfNotExists is true, when creating the stream, this is the shard count<T extends KinesisSDKStreamProducer>
TwithStream(String s) Methods inherited from class com.adaptris.core.ProduceOnlyProducerImp
produce, request, requestMethods inherited from class com.adaptris.core.AdaptrisMessageProducerImp
createNameMethods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueIDMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueIdMethods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactoryMethods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stopMethods inherited from interface com.adaptris.core.MessageEventGenerator
createQualifier, isTrackingEndpoint
-
Field Details
-
SHARD_COUNT_NONE
public static final int SHARD_COUNT_NONE- See Also:
-
-
Constructor Details
-
KinesisSDKStreamProducer
public KinesisSDKStreamProducer()
-
-
Method Details
-
prepare
- Throws:
CoreException
-
withStream
-
setPartitionKey
-
withPartitionKey
-
withRequestBuilder
-
withBatchWindow
-
withCreateIfNotExists
-
withShardCount
If createIfNotExists is true, when creating the stream, this is the shard count- Type Parameters:
T-- Parameters:
shardCount-- Returns:
-
withCreateStreamMaxWaitTimeMillis
If createIfNotExists is true, when creating the stream, this is the max wait time for the stream to become active- Type Parameters:
T-- Parameters:
millis-- Returns:
-
withCreateStreamPollTimeMillis
If createIfNotExists is true, when creating the stream, this is the wait time between polling to check if the stream is active- Type Parameters:
T-- Parameters:
millis-- Returns:
-
doProduce
- Specified by:
doProducein classProduceOnlyProducerImp- Throws:
ProduceException
-
doSend
protected void doSend(software.amazon.awssdk.services.kinesis.KinesisClient kinesisClient, String endpoint, List<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry> putRecordsRequestEntryList) throws ProduceException - Throws:
ProduceException
-
endpoint
- Specified by:
endpointin classAdaptrisMessageProducerImp- Throws:
ProduceException
-
getCreateStreamMaxWaitTimeMillis
public long getCreateStreamMaxWaitTimeMillis() -
setCreateStreamMaxWaitTimeMillis
public void setCreateStreamMaxWaitTimeMillis(long createStreamMaxWaitTimeMillis) -
getCreateStreamPollTimeMillis
public long getCreateStreamPollTimeMillis() -
setCreateStreamPollTimeMillis
public void setCreateStreamPollTimeMillis(long createStreamPollTimeMillis) -
getStream
The kinesis stream name. -
setStream
The kinesis stream name. -
getPartitionKey
The kinesis partition key. -
getRequestBuilder
Request Builder enables the control on how the records are put, this is used in conjunction with batchWindow. -
setRequestBuilder
Request Builder enables the control on how the records are put, this is used in conjunction with batchWindow. -
getBatchWindow
Batch window controls on how the records are put to the stream, this used in conjunction with a splitting implementation of the request builder. -
setBatchWindow
Batch window controls on how the records are put to the stream, this used in conjunction with a splitting implementation of the request builder. -
getCreateIfNotExists
public boolean getCreateIfNotExists()Toggles whether to create the stream if it does not exist at the time of sending -
setCreateIfNotExists
public void setCreateIfNotExists(boolean createIfNotExists) Toggles whether to create the stream if it does not exist at the time of sending -
getShardCount
public int getShardCount()If creating a stream, this specifies the number of shards for StreamMode.PROVISIONED. A value of 0 means StreamMode.ON_DEMAND. -
setShardCount
public void setShardCount(int shardCount) If creating a stream, this specifies the number of shards for StreamMode.PROVISIONED. A value of 0 means StreamMode.ON_DEMAND.
-