Class SendRequest.Builder

java.lang.Object
io.awspring.cloud.kinesis.operations.SendRequest.Builder
Enclosing class:
SendRequest

public static final class SendRequest.Builder extends Object
Builder for SendRequest. The stream name, the partition key, and either a payload or a message are required.
  • Method Details

    • streamName

      public SendRequest.Builder streamName(String streamName)
      Set the name of the stream to send the record to. Required.
      Parameters:
      streamName - the stream name.
      Returns:
      this builder.
    • partitionKey

      public SendRequest.Builder partitionKey(String partitionKey)
      Set the partition key that determines the shard. Required.
      Parameters:
      partitionKey - the partition key.
      Returns:
      this builder.
    • payload

      public SendRequest.Builder payload(Object payload)
      Set the payload to send. When a message is also set, this payload replaces the message payload and the message headers are kept.
      Parameters:
      payload - the payload.
      Returns:
      this builder.
    • message

      public SendRequest.Builder message(Message<?> message)
      Set the message to send, keeping its headers.
      Parameters:
      message - the message.
      Returns:
      this builder.
    • header

      public SendRequest.Builder header(String name, Object value)
      Add a custom header, overriding a message header of the same name.
      Parameters:
      name - the header name.
      value - the header value.
      Returns:
      this builder.
    • headers

      public SendRequest.Builder headers(Map<String,?> headers)
      Add custom headers, overriding message headers of the same name.
      Parameters:
      headers - the headers.
      Returns:
      this builder.
    • explicitHashKey

      public SendRequest.Builder explicitHashKey(@Nullable String explicitHashKey)
      Set a hash key that overrides the partition key hash when Kinesis picks the shard.
      Parameters:
      explicitHashKey - the explicit hash key, or null to use the partition key hash.
      Returns:
      this builder.
    • sequenceNumberForOrdering

      public SendRequest.Builder sequenceNumberForOrdering(@Nullable String sequenceNumberForOrdering)
      Set the sequence number of a previous record from the same partition key to keep strict ordering. Only applies to single-record sends; batch sends ignore it.
      Parameters:
      sequenceNumberForOrdering - the sequence number, or null for no ordering guarantee.
      Returns:
      this builder.
    • build

      public SendRequest build()
      Build the request.
      Returns:
      the request.
      Throws:
      IllegalArgumentException - if the stream name or partition key is empty, or neither a payload nor a message is set.