Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deviceinsight/kafka-health-check
Health Check for Apache Kafka
https://github.com/deviceinsight/kafka-health-check
health-check kafka spring spring-boot-actuator
Last synced: 22 days ago
JSON representation
Health Check for Apache Kafka
- Host: GitHub
- URL: https://github.com/deviceinsight/kafka-health-check
- Owner: deviceinsight
- License: apache-2.0
- Created: 2019-03-28T10:36:12.000Z (almost 6 years ago)
- Default Branch: develop
- Last Pushed: 2023-06-14T22:44:23.000Z (over 1 year ago)
- Last Synced: 2024-11-16T04:30:52.959Z (about 2 months ago)
- Topics: health-check, kafka, spring, spring-boot-actuator
- Language: Java
- Size: 103 KB
- Stars: 34
- Watchers: 20
- Forks: 16
- Open Issues: 8
-
Metadata Files:
- Readme: README.adoc
- Changelog: changelog.adoc
- License: LICENSE
Awesome Lists containing this project
README
= Kafka Health Check
:uri-build-status: https://travis-ci.org/deviceinsight/kafka-health-check
:img-build-status: https://api.travis-ci.org/deviceinsight/kafka-health-check.svg?branch=masterimage:{img-build-status}[Build Status Badge,link={uri-build-status}]
This library provides a kafka health check for spring boot actuator.
== Usage
Add the following dependency to your `pom.xml`
[source,xml]
....com.deviceinsight.kafka
kafka-health-check
1.3.0....
In the same maven module you can configure the topic, poll timeouts, subscription timeouts and the receive timeouts
in the `application.yml`An example for an `application.yaml` is:
[source,yaml]
....
kafka:
health:
topic: health-checks
sendReceiveTimeout: 2.5s
pollTimeout: 200ms
subscriptionTimeout: 5s
....The values shown are the defaults.
IMPORTANT: Make sure the configured health check topic exists!
[source,java]
....
@Bean
@ConfigurationProperties("kafka.health")
public KafkaHealthProperties kafkaHealthProperties() {
return new KafkaHealthProperties();
}
....[source,java]
....
@Bean
public KafkaConsumingHealthIndicator kafkaConsumingHealthIndicator(KafkaHealthProperties kafkaProperties,
KafkaProperties processingProperties) {
return new KafkaConsumingHealthIndicator(kafkaHealthProperties, processingProperties.buildConsumerProperties(),
processingProperties.buildProducerProperties());
}
....Now if you call the actuator endpoint `actuator/health` you should see the following output:
[source,json]
....
{
"status" : "UP",
"details" : {
"kafkaConsuming" : {
"status" : "UP"
}
}
}
....== Configuration
|===
|Property |Default |Description|kafka.health.topic |`health-checks` | Topic to subscribe to
|kafka.health.sendReceiveTimeout |2.5s | The maximum time, given as https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-duration[Duration], to wait for sending and receiving the message.
|kafka.health.pollTimeout |200ms | The time, given as https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-duration[Duration], spent fetching the data from the topic
|kafka.health.subscriptionTimeout |5s | The maximum time, given as https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-duration[Duration], to wait for subscribing to topic
|kafka.health.cache.maximumSize |200 | Specifies the maximum number of entries the cache may contain.|===
== Releasing
Creating a new release involves the following steps:
. `./mvnw gitflow:release-start gitflow:release-finish`
. `git push origin master`
. `git push --tags`
. `git push origin develop`In order to deploy the release to Maven Central, you need to create an account at https://issues.sonatype.org and
configure your account in `~/.m2/settings.xml`:[source,xml]
....
ossrh
your-jira-id
your-jira-pwd
....
The account also needs access to the project on Maven Central. This can be requested by another project member.
Then check out the release you want to deploy (`git checkout x.y.z`) and run `./mvnw deploy -Prelease`.