Reactor Kafka 绑定器健康指示器

Reactor Kafka 绑定器提供了一个 HealthIndicator 实现,该实现将在调用 Spring Boot Actuator health 端点时使用。当 Spring Boot actuator 依赖项在类路径上时,可以启用带有绑定器健康指示器的 Reactor Kafka 绑定器。这个健康指示器提供有关绑定器基于应用程序状态的信息,即它当前是 UP 还是 DOWN,应用程序正在使用的主题,以及绑定器内部使用的消息生产者组件的各种详细信息。

Reactor Kafka 绑定器健康指示器由框架内部以键 reactorKafka 注册。因此,可以按如下方式通过编程查询它。

CompositeHealthContributor compositeHealthContributor = context
			.getBean("bindersHealthContributor", CompositeHealthContributor.class);
ReactorKafkaBinderHealthIndicator healthIndicator = (ReactorKafkaBinderHealthIndicator) compositeHealthContributor.getContributor("reactorKafka");
Health health = healthIndicator.health();