spring-projects / spring-projects/spring-boot
Add HealthIndicator support for Apache Pulsar
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
Motivation
Spring Boot auto-configures Actuator HealthIndicators for a number of messaging and data infrastructure clients when they're on the classpath, including Redis, JDBC DataSource, MongoDB, Elasticsearch, and others. PulsarAutoConfiguration already auto-configures a PulsarClient and a PulsarAdministration bean, but there is no corresponding health indicator, so applications using spring-boot-starter-pulsar have no built-in way to expose the health of their Pulsar cluster through /actuator/health.
Problem
Without a PulsarHealthIndicator, teams running Pulsar-backed services must either write their own custom HealthIndicator, or go without cluster-health visibility in the Actuator health endpoint, unlike users of Redis, JDBC, MongoDB, etc. This is an inconsistency in an otherwise broad set of auto-configured health indicators.
Proposed Solution
Add a PulsarHealthIndicator (org.springframework.boot.pulsar.health) that performs a broker healthcheck through the already auto-configured PulsarAdministration client (PulsarAdmin.brokers().healthcheckAsync(), bounded by a configurable timeout), reporting UP/DOWN accordingly. Wire it up with a PulsarHealthContributorAutoConfiguration (org.springframework.boot.pulsar.autoconfigure.health), conditional on PulsarAdministration being on the classpath and present as a bean, and on spring-boot-actuator being present -- following Spring Boot's standard health-indicator auto-configuration conventions (@ConditionalOnClass/@ConditionalOnBean/@ConditionalOnEnabledHealthIndicator("pulsar")).
I already have a working prototype of this (indicator, auto-configuration, unit tests for the UP/DOWN/timeout cases, and documentation updates to the Pulsar reference page and the Actuator health-indicators table) and I'm happy to submit it as a PR once the general direction is confirmed by a maintainer.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed org.springframework.boot.pulsar.health.PulsarHealthIndicator and org.springframework.boot.pulsar.autoconfigure.health.PulsarHealthContributorAutoConfiguration, using PulsarAdministration and healthcheckAsync() as the entry points. Review the prototype's unit tests for UP, DOWN, and timeout cases, plus the Pulsar reference page and Actuator health-indicators table. Done means the indicator is conditionally auto-configured and the behavior and documentation are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, documentation, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100