Class MicrometerConsumerListener<K,​V>

  • Type Parameters:
    K - the key type.
    V - the value type.
    All Implemented Interfaces:
    ConsumerFactory.Listener<K,​V>

    public class MicrometerConsumerListener<K,​V>
    extends java.lang.Object
    implements ConsumerFactory.Listener<K,​V>
    A consumer factory listener that manages KafkaClientMetrics.
    Since:
    2.5
    Author:
    Gary Russell
    • Constructor Summary

      Constructors 
      Constructor Description
      MicrometerConsumerListener​(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Construct an instance with the provided registry.
      MicrometerConsumerListener​(io.micrometer.core.instrument.MeterRegistry meterRegistry, java.util.List<io.micrometer.core.instrument.Tag> tags)
      Construct an instance with the provided registry and tags.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void consumerAdded​(java.lang.String id, org.apache.kafka.clients.consumer.Consumer<K,​V> consumer)
      A new consumer was created.
      void consumerRemoved​(java.lang.String id, org.apache.kafka.clients.consumer.Consumer<K,​V> consumer)
      An existing consumer was removed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MicrometerConsumerListener

        public MicrometerConsumerListener​(io.micrometer.core.instrument.MeterRegistry meterRegistry)
        Construct an instance with the provided registry.
        Parameters:
        meterRegistry - the registry.
      • MicrometerConsumerListener

        public MicrometerConsumerListener​(io.micrometer.core.instrument.MeterRegistry meterRegistry,
                                          java.util.List<io.micrometer.core.instrument.Tag> tags)
        Construct an instance with the provided registry and tags.
        Parameters:
        meterRegistry - the registry.
        tags - the tags.
    • Method Detail

      • consumerAdded

        public void consumerAdded​(java.lang.String id,
                                  org.apache.kafka.clients.consumer.Consumer<K,​V> consumer)
        Description copied from interface: ConsumerFactory.Listener
        A new consumer was created.
        Specified by:
        consumerAdded in interface ConsumerFactory.Listener<K,​V>
        Parameters:
        id - the consumer id (factory bean name and client.id separated by a period).
        consumer - the consumer.
      • consumerRemoved

        public void consumerRemoved​(java.lang.String id,
                                    org.apache.kafka.clients.consumer.Consumer<K,​V> consumer)
        Description copied from interface: ConsumerFactory.Listener
        An existing consumer was removed.
        Specified by:
        consumerRemoved in interface ConsumerFactory.Listener<K,​V>
        Parameters:
        id - the consumer id (factory bean name and client.id separated by a period).
        consumer - the consumer.