Package org.springframework.kafka.core
Class MicrometerProducerListener<K,V>
java.lang.Object
org.springframework.kafka.core.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 Object
implements ProducerFactory.Listener<K,V>
A producer factory listener that manages
KafkaClientMetrics
.- Since:
- 2.5
- Author:
- Gary Russell
-
Constructor Summary
ConstructorsConstructorDescriptionMicrometerProducerListener
(io.micrometer.core.instrument.MeterRegistry meterRegistry) Construct an instance with the provided registry.MicrometerProducerListener
(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags) Construct an instance with the provided registry and tags. -
Method Summary
Modifier and TypeMethodDescriptionvoid
producerAdded
(String id, org.apache.kafka.clients.producer.Producer<K, V> producer) A new producer was created.void
producerRemoved
(String id, org.apache.kafka.clients.producer.Producer<K, V> producer) An existing producer was removed.
-
Constructor Details
-
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, List<io.micrometer.core.instrument.Tag> tags) Construct an instance with the provided registry and tags.- Parameters:
meterRegistry
- the registry.tags
- the tags.
-
-
Method Details
-
producerAdded
Description copied from interface:ProducerFactory.Listener
A new producer was created.- Specified by:
producerAdded
in interfaceProducerFactory.Listener<K,
V> - Parameters:
id
- the producer id (factory bean name and client.id separated by a period).producer
- the producer.
-
producerRemoved
Description copied from interface:ProducerFactory.Listener
An existing producer was removed.- Specified by:
producerRemoved
in interfaceProducerFactory.Listener<K,
V> - Parameters:
id
- the producer id (factory bean name and client.id separated by a period).producer
- the producer.
-