Interface KinesisOperations
- All Known Implementing Classes:
KinesisTemplate
public interface KinesisOperations
Operations for sending records to Kinesis Data Streams.
Each method has a synchronous variant that blocks until Kinesis has acknowledged the record and an Async
variant returning a CompletableFuture. Payloads are serialized by the configured
KinesisMessageConverter.
- Since:
- 4.3.0
- Author:
- Matej Nedic
-
Method Summary
Modifier and TypeMethodDescriptionsend(SendRequest request) Sends the given record, allowing all record attributes to be set.Sends a record with a random partition key, so it is distributed across the stream's shards.Sends a record with the given partition key, which determines the shard and therefore the ordering group.default SendResultSends a message with the given partition key, keeping its headers.default SendResultSends a message, keeping its headers.sendAsync(SendRequest request) Asynchronously sends the given record.Asynchronously sends a record with the given partition key.default CompletableFuture<SendResult>Asynchronously sends a message with the given partition key, keeping its headers.default CompletableFuture<SendResult>Asynchronously sends a message, keeping its headers.sendBatch(String streamName, List<SendRequest> requests) Sends any number of records to the same stream, splitting them intoPutRecordscalls of at most 500 records and 5 MiB each, a conservative size below the current 10 MiBPutRecordslimit, and merging the results in request order.sendBatchAsync(String streamName, List<SendRequest> requests) Asynchronously sends any number of records to the same stream, splitting them intoPutRecordscalls of at most 500 records and 5 MiB each, a conservative size below the current 10 MiBPutRecordslimit.
-
Method Details
-
send
Sends a record with a random partition key, so it is distributed across the stream's shards.- Parameters:
streamName- the target stream.payload- the payload to serialize and send.- Returns:
- the sequence number and shard the record was written to.
-
send
Sends a record with the given partition key, which determines the shard and therefore the ordering group.- Parameters:
streamName- the target stream.partitionKey- the partition key.payload- the payload to serialize and send.- Returns:
- the sequence number and shard the record was written to.
-
send
Sends the given record, allowing all record attributes to be set.- Parameters:
request- the record to send.- Returns:
- the sequence number and shard the record was written to.
-
sendAsync
Asynchronously sends a record with the given partition key.- Parameters:
streamName- the target stream.partitionKey- the partition key.payload- the payload to serialize and send.- Returns:
- a future completing with the sequence number and shard the record was written to.
-
sendAsync
Asynchronously sends the given record.- Parameters:
request- the record to send.- Returns:
- a future completing with the sequence number and shard the record was written to.
-
sendBatch
Sends any number of records to the same stream, splitting them intoPutRecordscalls of at most 500 records and 5 MiB each, a conservative size below the current 10 MiBPutRecordslimit, and merging the results in request order. Individual records can fail while a call as a whole succeeds, so the result reports successful and failed records separately.- Parameters:
streamName- the target stream, which every request must target.requests- the records to send.- Returns:
- the successful and failed records of the batch, in request order.
-
sendBatchAsync
Asynchronously sends any number of records to the same stream, splitting them intoPutRecordscalls of at most 500 records and 5 MiB each, a conservative size below the current 10 MiBPutRecordslimit.- Parameters:
streamName- the target stream, which every request must target.requests- the records to send.- Returns:
- a future completing with the successful and failed records of the batch, in request order.
-
send
Sends a message, keeping its headers. The partition key is theKinesisMessageHeaders.PARTITION_KEYheader when present, otherwise a random one.- Parameters:
streamName- the target stream.message- the message to send.- Returns:
- the sequence number and shard the record was written to.
- Since:
- 4.3.0
-
send
Sends a message with the given partition key, keeping its headers.- Parameters:
streamName- the target stream.partitionKey- the partition key.message- the message to send.- Returns:
- the sequence number and shard the record was written to.
- Since:
- 4.3.0
-
sendAsync
Asynchronously sends a message, keeping its headers. The partition key is resolved as insend(String, Message).- Parameters:
streamName- the target stream.message- the message to send.- Returns:
- a future completing with the sequence number and shard the record was written to.
- Since:
- 4.3.0
-
sendAsync
default CompletableFuture<SendResult> sendAsync(String streamName, String partitionKey, Message<?> message) Asynchronously sends a message with the given partition key, keeping its headers.- Parameters:
streamName- the target stream.partitionKey- the partition key.message- the message to send.- Returns:
- a future completing with the sequence number and shard the record was written to.
- Since:
- 4.3.0
-