Class OutgoingKafkaRecord<K,T>

java.lang.Object
io.smallrye.reactive.messaging.kafka.OutgoingKafkaRecord<K,T>
All Implemented Interfaces:
KafkaRecord<K,T>, ContextAwareMessage<T>, org.eclipse.microprofile.reactive.messaging.Message<T>

public class OutgoingKafkaRecord<K,T> extends Object implements KafkaRecord<K,T>
  • Constructor Details

  • Method Details

    • from

      public static <K, T> OutgoingKafkaRecord<K,T> from(org.eclipse.microprofile.reactive.messaging.Message<T> message)
    • ack

      public CompletionStage<Void> ack()
      Specified by:
      ack in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • getPayload

      public T getPayload()
      Specified by:
      getPayload in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • getKey

      public K getKey()
      Specified by:
      getKey in interface KafkaRecord<K,T>
    • getTopic

      public String getTopic()
      Specified by:
      getTopic in interface KafkaRecord<K,T>
    • getTimestamp

      public Instant getTimestamp()
      Specified by:
      getTimestamp in interface KafkaRecord<K,T>
    • getHeaders

      public org.apache.kafka.common.header.Headers getHeaders()
      Specified by:
      getHeaders in interface KafkaRecord<K,T>
    • getAck

      public Supplier<CompletionStage<Void>> getAck()
      Specified by:
      getAck in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • getNack

      public Function<Throwable,CompletionStage<Void>> getNack()
      Specified by:
      getNack in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • getPartition

      public int getPartition()
      Specified by:
      getPartition in interface KafkaRecord<K,T>
    • getMetadata

      public org.eclipse.microprofile.reactive.messaging.Metadata getMetadata()
      Specified by:
      getMetadata in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • withHeader

      public OutgoingKafkaRecord<K,T> withHeader(String key, byte[] content)
      Creates a new outgoing Kafka Message with a header added to the header list.
      Parameters:
      key - the header key
      content - the header key, must not be null
      Returns:
      the updated Kafka Message.
    • withHeader

      public OutgoingKafkaRecord<K,T> withHeader(String key, String content)
      Creates a new outgoing Kafka Message with a header added to the header list.
      Parameters:
      key - the header key
      content - the header key, must not be null
      Returns:
      the updated Kafka Message.
    • withHeader

      public OutgoingKafkaRecord<K,T> withHeader(String key, String content, Charset enc)
      Creates a new outgoing Kafka Message with a header added to the header list.
      Parameters:
      key - the header key
      content - the header key, must not be null
      enc - the encoding, must not be null
      Returns:
      the updated Kafka Message.
    • with

      public OutgoingKafkaRecord<K,T> with(String topic, K key, T value)
    • with

      public OutgoingKafkaRecord<K,T> with(String topic, T value)
    • with

      public OutgoingKafkaRecord<K,T> with(String topic, K key, T value, Instant timestamp, int partition)
    • withPayload

      public <P> OutgoingKafkaRecord<K,P> withPayload(P payload)
      Specified by:
      withPayload in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • withMetadata

      public OutgoingKafkaRecord<K,T> withMetadata(Iterable<Object> metadata)
      Specified by:
      withMetadata in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • withMetadata

      public OutgoingKafkaRecord<K,T> withMetadata(org.eclipse.microprofile.reactive.messaging.Metadata metadata)
      Specified by:
      withMetadata in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • withAck

      public OutgoingKafkaRecord<K,T> withAck(Supplier<CompletionStage<Void>> supplier)
      Specified by:
      withAck in interface org.eclipse.microprofile.reactive.messaging.Message<K>
    • withNack

      Specified by:
      withNack in interface org.eclipse.microprofile.reactive.messaging.Message<K>