Package org.springframework.kafka.core
Class MicrometerConsumerListener<K,V>
java.lang.Object
org.springframework.kafka.core.KafkaMetricsSupport<org.apache.kafka.clients.consumer.Consumer<K,V>>
org.springframework.kafka.core.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 KafkaMetricsSupport<org.apache.kafka.clients.consumer.Consumer<K,V>>
implements ConsumerFactory.Listener<K,V>
A consumer factory listener that manages
KafkaClientMetrics
.- Since:
- 2.5
- Author:
- Gary Russell, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.kafka.core.KafkaMetricsSupport
meterRegistry, scheduler, tags
-
Constructor Summary
ConstructorsConstructorDescriptionMicrometerConsumerListener
(io.micrometer.core.instrument.MeterRegistry meterRegistry) Construct an instance with the provided registry.MicrometerConsumerListener
(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags) Construct an instance with the provided registry and tags.MicrometerConsumerListener
(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags, TaskScheduler taskScheduler) Construct an instance with the provided registry, tags and task scheduler.MicrometerConsumerListener
(io.micrometer.core.instrument.MeterRegistry meterRegistry, TaskScheduler taskScheduler) Construct an instance with the provided registry and task scheduler. -
Method Summary
Modifier and TypeMethodDescriptionvoid
consumerAdded
(String id, org.apache.kafka.clients.consumer.Consumer<K, V> consumer) A new consumer was created.void
consumerRemoved
(String id, org.apache.kafka.clients.consumer.Consumer<K, V> consumer) An existing consumer was removed.Methods inherited from class org.springframework.kafka.core.KafkaMetricsSupport
bindClient, createClientMetrics, unbindClient
-
Constructor Details
-
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, TaskScheduler taskScheduler) Construct an instance with the provided registry and task scheduler.- Parameters:
meterRegistry
- the registry.taskScheduler
- the task scheduler.- Since:
- 3.3
-
MicrometerConsumerListener
public MicrometerConsumerListener(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.
-
MicrometerConsumerListener
public MicrometerConsumerListener(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags, TaskScheduler taskScheduler) Construct an instance with the provided registry, tags and task scheduler.- Parameters:
meterRegistry
- the registry.tags
- the tags.taskScheduler
- the task scheduler.- Since:
- 3.3
-
-
Method Details
-
consumerAdded
Description copied from interface:ConsumerFactory.Listener
A new consumer was created.- Specified by:
consumerAdded
in interfaceConsumerFactory.Listener<K,
V> - Parameters:
id
- the consumer id (factory bean name and client.id separated by a period).consumer
- the consumer.
-
consumerRemoved
Description copied from interface:ConsumerFactory.Listener
An existing consumer was removed.- Specified by:
consumerRemoved
in interfaceConsumerFactory.Listener<K,
V> - Parameters:
id
- the consumer id (factory bean name and client.id separated by a period).consumer
- the consumer.
-