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 Details

    • send

      SendResult send(String streamName, Object payload)
      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

      SendResult send(String streamName, String partitionKey, Object payload)
      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

      SendResult send(SendRequest request)
      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

      CompletableFuture<SendResult> sendAsync(String streamName, String partitionKey, Object payload)
      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

      BatchSendResult sendBatch(String streamName, List<SendRequest> requests)
      Sends any number of records to the same stream, splitting them into PutRecords calls of at most 500 records and 5 MiB each, a conservative size below the current 10 MiB PutRecords limit, 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

      CompletableFuture<BatchSendResult> sendBatchAsync(String streamName, List<SendRequest> requests)
      Asynchronously sends any number of records to the same stream, splitting them into PutRecords calls of at most 500 records and 5 MiB each, a conservative size below the current 10 MiB PutRecords limit.
      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

      default SendResult send(String streamName, Message<?> message)
      Sends a message, keeping its headers. The partition key is the KinesisMessageHeaders.PARTITION_KEY header 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

      default SendResult send(String streamName, String partitionKey, Message<?> message)
      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

      default CompletableFuture<SendResult> sendAsync(String streamName, Message<?> message)
      Asynchronously sends a message, keeping its headers. The partition key is resolved as in send(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