Class MicrometerProducerListener<K,​V>

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

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

      Constructors 
      Constructor Description
      MicrometerProducerListener​(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Construct an instance with the provided registry.
      MicrometerProducerListener​(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 producerAdded​(java.lang.String id, org.apache.kafka.clients.producer.Producer<K,​V> producer)
      A new producer was created.
      void producerRemoved​(java.lang.String id, org.apache.kafka.clients.producer.Producer<K,​V> producer)
      An exsting producer was removed.
      • Methods inherited from class java.lang.Object

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

      • MicrometerProducerListener

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

        public MicrometerProducerListener​(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

      • producerAdded

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

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