Class KafkaRecordReceiverContext

java.lang.Object
io.micrometer.observation.Observation.Context
io.micrometer.observation.transport.ReceiverContext<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>
org.springframework.kafka.support.micrometer.KafkaRecordReceiverContext
All Implemented Interfaces:
io.micrometer.observation.Observation.ContextView

public class KafkaRecordReceiverContext extends io.micrometer.observation.transport.ReceiverContext<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>
ReceiverContext for ConsumerRecords.
Since:
3.0
Author:
Gary Russell, Christian Mergenthaler, Wang Zhiyang
  • Constructor Summary

    Constructors
    Constructor
    Description
    KafkaRecordReceiverContext(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, String listenerId, String clientId, String groupId, Supplier<String> clusterId)
    Construct a kafka record receiver context.
    KafkaRecordReceiverContext(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, String listenerId, Supplier<String> clusterId)
    Construct a kafka record receiver context.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the client id.
    Return the consumer group id.
    Return the listener id.
    Return the offset.
    Return the partition.
    org.apache.kafka.clients.consumer.ConsumerRecord<?,?>
    Return the consumer record.
    Return the source topic.

    Methods inherited from class io.micrometer.observation.transport.ReceiverContext

    getCarrier, getGetter, getKind, getRemoteServiceAddress, getRemoteServiceName, setCarrier, setRemoteServiceAddress, setRemoteServiceName

    Methods inherited from class io.micrometer.observation.Observation.Context

    addHighCardinalityKeyValue, addHighCardinalityKeyValues, addLowCardinalityKeyValue, addLowCardinalityKeyValues, clear, computeIfAbsent, containsKey, get, getAllKeyValues, getContextualName, getError, getHighCardinalityKeyValue, getHighCardinalityKeyValues, getLowCardinalityKeyValue, getLowCardinalityKeyValues, getName, getOrDefault, getParentObservation, getRequired, put, remove, removeHighCardinalityKeyValue, removeHighCardinalityKeyValues, removeLowCardinalityKeyValue, removeLowCardinalityKeyValues, setContextualName, setError, setName, setParentObservation, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.micrometer.observation.Observation.ContextView

    getOrDefault
  • Constructor Details

    • KafkaRecordReceiverContext

      public KafkaRecordReceiverContext(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, String listenerId, Supplier<String> clusterId)
      Construct a kafka record receiver context.
      Parameters:
      record - the consumer record.
      listenerId - the container listener id.
      clusterId - the kafka cluster id.
    • KafkaRecordReceiverContext

      public KafkaRecordReceiverContext(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, String listenerId, String clientId, String groupId, Supplier<String> clusterId)
      Construct a kafka record receiver context.
      Parameters:
      record - the consumer record.
      listenerId - the container listener id.
      clientId - the kafka client id.
      groupId - the consumer group id.
      clusterId - the kafka cluster id.
      Since:
      3.2
  • Method Details

    • getListenerId

      public String getListenerId()
      Return the listener id.
      Returns:
      the listener id.
    • getGroupId

      public String getGroupId()
      Return the consumer group id.
      Returns:
      the consumer group id.
      Since:
      3.2
    • getClientId

      @Nullable public String getClientId()
      Return the client id.
      Returns:
      the client id.
      Since:
      3.2
    • getSource

      public String getSource()
      Return the source topic.
      Returns:
      the source.
    • getRecord

      public org.apache.kafka.clients.consumer.ConsumerRecord<?,?> getRecord()
      Return the consumer record.
      Returns:
      the record.
      Since:
      3.0.6
    • getPartition

      public String getPartition()
      Return the partition.
      Returns:
      the partition.
      Since:
      3.2
    • getOffset

      public String getOffset()
      Return the offset.
      Returns:
      the offset.
      Since:
      3.2