Class KafkaHealthIndicator
java.lang.Object
io.micronaut.configuration.kafka.health.KafkaHealthIndicator
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,io.micronaut.management.health.indicator.HealthIndicator
@Singleton
@Requires(beans=org.apache.kafka.clients.admin.AdminClient.class) @Requires(property="kafka.health.enabled",value="true",defaultValue="true")
public class KafkaHealthIndicator
extends Object
implements io.micronaut.management.health.indicator.HealthIndicator
A
HealthIndicator for Kafka.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionKafkaHealthIndicator(AdminClient adminClient, KafkaDefaultConfiguration defaultConfiguration) Constructs a new Kafka health indicator for the given arguments. -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetClusterReplicationFactor(Config config) Retrieve the cluster "offsets.topic.replication.factor" for the givenConfig, falling back to "default.replication.factor" if required, in order to support Confluent Cloud hosted Kafka.reactor.core.publisher.Flux<io.micronaut.management.health.indicator.HealthResult>Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
KafkaHealthIndicator
public KafkaHealthIndicator(AdminClient adminClient, KafkaDefaultConfiguration defaultConfiguration) Constructs a new Kafka health indicator for the given arguments.- Parameters:
adminClient- The admin clientdefaultConfiguration- The default configuration
-
-
Method Details
-
getClusterReplicationFactor
Retrieve the cluster "offsets.topic.replication.factor" for the givenConfig, falling back to "default.replication.factor" if required, in order to support Confluent Cloud hosted Kafka.- Parameters:
config- the clusterConfig- Returns:
- the cluster replication factor, or Integer.MAX_VALUE if none found
-
getResult
public reactor.core.publisher.Flux<io.micronaut.management.health.indicator.HealthResult> getResult()- Specified by:
getResultin interfaceio.micronaut.management.health.indicator.HealthIndicator
-