Interface OutboundKinesisRecordBuilder
-
@DoNotImplement public interface OutboundKinesisRecordBuilder
TheOutboundKinesisRecordBuilder
enables the creation ofOutboundKinesisRecord
s via its fluent API.Make sure that at least
streamName
,data
andpartitionKey
is set before callingbuild()
.The internal state of this interface can only be changed via its methods. All arguments, that have mutable data types, are deep copied before the setting method returns.
- Since:
- 4.14.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull OutboundKinesisRecord
build()
Create a newOutboundKinesisRecord
from the current state of this builder.@NotNull OutboundKinesisRecordBuilder
data(byte @NotNull [] data)
Set thedata
of the Amazon Kinesis record.@NotNull OutboundKinesisRecordBuilder
data(@NotNull String data)
Set thedata
of the Amazon Kinesis record.@NotNull OutboundKinesisRecordBuilder
data(@NotNull String data, @NotNull Charset charset)
Set thedata
of the Amazon Kinesis record.@NotNull OutboundKinesisRecordBuilder
data(@NotNull ByteBuffer data)
Set thedata
of the Amazon Kinesis record.@NotNull OutboundKinesisRecordBuilder
explicitHashKey(@NotNull BigInteger explicitHashKey)
Set theexplicitHashKey
of the Amazon Kinesis record.@NotNull OutboundKinesisRecordBuilder
partitionKey(@NotNull String partitionKey)
Set thepartitionKey
of the Amazon Kinesis record.@NotNull OutboundKinesisRecordBuilder
randomExplicitHashKey()
Set theexplicitHashKey
of the Amazon Kinesis record to a random value.@NotNull OutboundKinesisRecordBuilder
randomPartitionKey()
Set thepartitionKey
of the Amazon Kinesis record to a random value.@NotNull OutboundKinesisRecordBuilder
streamName(@NotNull String streamName)
Set thestreamName
of the Amazon Kinesis record.
-
-
-
Method Detail
-
streamName
@NotNull @NotNull OutboundKinesisRecordBuilder streamName(@NotNull @NotNull String streamName)
Set thestreamName
of the Amazon Kinesis record. This is required to successfully build aOutboundKinesisRecord
.Must conform to the following guidelines:
- Contain between 1 and 128 characters
- Contain only the following characters
- Letters [A-Za-z]
- numbers [0-9]
- dashes -
- underscores _
- periods .
- Parameters:
streamName
- The name of the Amazon Kinesis stream.- Returns:
- This builder.
- Throws:
NullPointerException
- IfstreamName
is null.IllegalArgumentException
- IfstreamName
is not conform with the guidelines listed above.- Since:
- 4.14.0
-
data
@NotNull @NotNull OutboundKinesisRecordBuilder data(@NotNull @NotNull ByteBuffer data)
Set thedata
of the Amazon Kinesis record.- Parameters:
data
- The value of the data.- Returns:
- This builder.
- Throws:
NullPointerException
- Ifdata
is null.IllegalArgumentException
- Ifdata
exceeds the max size of 1,048,576 bytes (1MB).- Since:
- 4.14.0
-
data
@NotNull @NotNull OutboundKinesisRecordBuilder data(byte @NotNull [] data)
Set thedata
of the Amazon Kinesis record.- Parameters:
data
- The value of the data.- Returns:
- This builder.
- Throws:
NullPointerException
- Ifdata
is null.IllegalArgumentException
- Ifdata
exceeds the max size of 1,048,576 bytes (1MB).- Since:
- 4.14.0
-
data
@NotNull @NotNull OutboundKinesisRecordBuilder data(@NotNull @NotNull String data)
Set thedata
of the Amazon Kinesis record.- Parameters:
data
- The value of the dataStandardCharsets.UTF_8
is used for encoding.- Returns:
- This builder.
- Throws:
NullPointerException
- Ifdata
is null.IllegalArgumentException
- Ifdata
exceeds the max size of 1,048,576 bytes (1MB).- Since:
- 4.14.0
-
data
@NotNull @NotNull OutboundKinesisRecordBuilder data(@NotNull @NotNull String data, @NotNull @NotNull Charset charset)
Set thedata
of the Amazon Kinesis record.- Parameters:
data
- The value of the data.charset
- TheCharset
used for encoding.- Returns:
- This builder.
- Throws:
NullPointerException
- Ifdata
orcharset
is null.IllegalArgumentException
- Ifdata
exceeds the max size of 1,048,576 bytes (1MB).- Since:
- 4.14.0
-
partitionKey
@NotNull @NotNull OutboundKinesisRecordBuilder partitionKey(@NotNull @NotNull String partitionKey)
Set thepartitionKey
of the Amazon Kinesis record.The MD5 hash of the
partitionKey
determines the shard in the destination Amazon Kinesis data stream. If you also setexplicitHashKey
, theexplicitHashKey
determines the destination shard instead.- Parameters:
partitionKey
- The partitionKey.- Returns:
- This builder.
- Throws:
NullPointerException
- IfpartitionKey
is null.IllegalArgumentException
- IfpartitionKey
is empty.IllegalArgumentException
- IfpartitionKey
exceeds the max size of 256 chars.- Since:
- 4.14.0
-
randomPartitionKey
@NotNull @NotNull OutboundKinesisRecordBuilder randomPartitionKey()
Set thepartitionKey
of the Amazon Kinesis record to a random value.The MD5 hash of the
partitionKey
determines the shard in the destination Amazon Kinesis data stream. If you also setexplicitHashKey
, theexplicitHashKey
determines the destination shard instead.- Returns:
- This builder.
- Since:
- 4.14.0
-
explicitHashKey
@NotNull @NotNull OutboundKinesisRecordBuilder explicitHashKey(@NotNull @NotNull BigInteger explicitHashKey)
Set theexplicitHashKey
of the Amazon Kinesis record.Explicitly defines the hash key for the shard assignment in the destination Amazon Kinesis Data Stream. This setting overrides the
partitionKey
shard assignment.- Parameters:
explicitHashKey
- The explicitHashKey.- Returns:
- This builder.
- Throws:
NullPointerException
- IfexplicitHashKey
is null.IllegalArgumentException
- IfpartitionKey < 0 or >= 2^128
.- Since:
- 4.14.0
-
randomExplicitHashKey
@NotNull @NotNull OutboundKinesisRecordBuilder randomExplicitHashKey()
Set theexplicitHashKey
of the Amazon Kinesis record to a random value.Explicitly defines the hash key for the shard assignment in the destination Amazon Kinesis Data Stream. This setting overrides the
partitionKey
shard assignment.- Returns:
- This builder.
- Since:
- 4.14.0
-
build
@NotNull @NotNull OutboundKinesisRecord build()
Create a newOutboundKinesisRecord
from the current state of this builder. The builder can be reused afterwards.- Returns:
- A new
OutboundKinesisRecord
containing a snapshot of the current state of this builder. - Throws:
IllegalStateException
- IfstreamName
,data
orpartitionKey
was not set.- Since:
- 4.14.0
-
-