Class SendRequest

java.lang.Object
io.awspring.cloud.kinesis.operations.SendRequest

public final class SendRequest extends Object
A record to send to Kinesis. The content is either a plain payload or a Spring Message, optionally combined with custom headers.

When a message is set, its headers are passed to the converter. A payload set as well replaces the payload of the message and keeps its headers. Custom headers override message headers of the same name. Custom headers are only visible on the wire when the converter embeds headers (see EmbeddedHeadersKinesisMessageConverter).

Instances are immutable: the custom headers are copied at build time.

Since:
4.3.0
Author:
Matej Nedic
  • Method Details

    • builder

      public static SendRequest.Builder builder()
      Create a new SendRequest.Builder.
      Returns:
      a new builder.
    • streamName

      public String streamName()
      The name of the stream the record is sent to.
      Returns:
      the stream name.
    • partitionKey

      public String partitionKey()
      The partition key Kinesis hashes to pick the shard, unless an explicit hash key is set.
      Returns:
      the partition key.
    • payload

      public Object payload()
      The payload to serialize: the payload set on the builder, otherwise the payload of message().
      Returns:
      the payload.
    • message

      public @Nullable Message<?> message()
      The message to send, if the request was built from one.
      Returns:
      the message, or null for a payload request.
    • headers

      public Map<String,Object> headers()
      The custom headers, not including the headers of message().
      Returns:
      an immutable map of custom headers.
    • explicitHashKey

      public @Nullable String explicitHashKey()
      The hash key that overrides the partition key hash when Kinesis picks the shard.
      Returns:
      the explicit hash key, or null to use the partition key hash.
    • sequenceNumberForOrdering

      public @Nullable String sequenceNumberForOrdering()
      The sequence number of a previous record from the same partition key, used to keep strict ordering for single-record sends. Ignored by batch sends, because PutRecords does not support it.
      Returns:
      the sequence number for ordering, or null if not set.