Class KafkaEventObserver
- java.lang.Object
-
- io.quarkus.micrometer.runtime.binder.kafka.KafkaEventObserver
-
@ApplicationScoped public class KafkaEventObserver extends Object
Observer to create and register KafkaClientMetrics. This observer uses only classes from "kafka-clients" and none from "kafka-streams". Must be separated from KafkaStreamsEventObserver, because they use different dependencies and if only kafka-client is used, the classes from kafka-streams aren't loaded.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Map<Object,io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics>
clientMetrics
(package private) io.micrometer.core.instrument.MeterRegistry
registry
-
Constructor Summary
Constructors Constructor Description KafkaEventObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
consumerCreated(org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Manage bind/close of KafkaClientMetrics for the specified Consumer.(package private) void
onStop(ShutdownEvent event)
void
producerCreated(org.apache.kafka.clients.producer.Producer<?,?> producer)
Manage bind/close of KafkaClientMetrics for the specified Producer.(package private) void
tryToClose(AutoCloseable c)
-
-
-
Method Detail
-
consumerCreated
public void consumerCreated(@Observes org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Manage bind/close of KafkaClientMetrics for the specified Consumer. If the consumer has not been seen before, it will be bound to the Micrometer registry and instrumented using a Kafka MeterBinder. If the consumer has been seen before, the MeterBinder will be closed.- Parameters:
consumer
- Observed Kafka Consumer
-
producerCreated
public void producerCreated(@Observes org.apache.kafka.clients.producer.Producer<?,?> producer)
Manage bind/close of KafkaClientMetrics for the specified Producer. If the producer has not been seen before, it will be bound to the Micrometer registry and instrumented using a Kafka MeterBinder. If the producer has been seen before, the MeterBinder will be closed.- Parameters:
producer
- Observed Kafka Producer
-
onStop
void onStop(@Observes ShutdownEvent event)
-
tryToClose
void tryToClose(AutoCloseable c)
-
-