Class IncomingKafkaRecordMetadata<K,T>

java.lang.Object
io.smallrye.reactive.messaging.kafka.api.IncomingKafkaRecordMetadata<K,T>
Type Parameters:
K - The Kafka record key type
T - The payload type
All Implemented Interfaces:
KafkaMessageMetadata<K>

public class IncomingKafkaRecordMetadata<K,T> extends Object implements KafkaMessageMetadata<K>
Contains information about messages received from a channel backed by Kafka. Generally this will be created by the framework, and users should not construct instances of this class.
  • Constructor Details

    • IncomingKafkaRecordMetadata

      public IncomingKafkaRecordMetadata(org.apache.kafka.clients.consumer.ConsumerRecord<K,T> record, String channel, int index, int consumerGroupGenerationId)
      Constructor
      Parameters:
      record - the underlying record received from Kafka
    • IncomingKafkaRecordMetadata

      public IncomingKafkaRecordMetadata(org.apache.kafka.clients.consumer.ConsumerRecord<K,T> record, String channel)
  • Method Details

    • getTopic

      public String getTopic()
      Get the topic
      Specified by:
      getTopic in interface KafkaMessageMetadata<K>
      Returns:
      the name of the topic
    • getKey

      public K getKey()
      Get the key
      Specified by:
      getKey in interface KafkaMessageMetadata<K>
      Returns:
      the key
    • getPartition

      public int getPartition()
      Get the partition
      Specified by:
      getPartition in interface KafkaMessageMetadata<K>
      Returns:
      the partition
    • getTimestamp

      public Instant getTimestamp()
      Get the timestamp
      Specified by:
      getTimestamp in interface KafkaMessageMetadata<K>
      Returns:
      the timestamp
    • getTimestampType

      public org.apache.kafka.common.record.TimestampType getTimestampType()
      Get the timestamp type
      Returns:
      the timestamp type
    • getOffset

      public long getOffset()
      Get the offset
      Returns:
      the offset
    • getHeaders

      public org.apache.kafka.common.header.Headers getHeaders()
      Get the Kafka headers
      Specified by:
      getHeaders in interface KafkaMessageMetadata<K>
      Returns:
      the Kafka headers
    • getRecord

      public org.apache.kafka.clients.consumer.ConsumerRecord<K,T> getRecord()
      Get the underlying Kafka ConsumerRecord
      Returns:
      the underlying Kafka ConsumerRecord
    • getChannel

      public String getChannel()
    • getConsumerIndex

      public int getConsumerIndex()
    • getConsumerGroupGenerationId

      public int getConsumerGroupGenerationId()
      Returns:
      the consumer group metadata generation id at the time of polling this record