Giter Site home page Giter Site logo

Comments (6)

fhussonnois avatar fhussonnois commented on June 15, 2024

Hi @Fryuni, currently Azkarra exposes the /health endpoint that returns some information about the state of all KafkaStreams instances. In addition, it provides a basic HealthIndicator for Kafka Streams (StreamsHealthIndicator).

Basically, the service is considered to be:

  • UP if the KafkaStreams's state is RUNNING (/health returned with HTTP code 200).
  • DOWN if the KafkaStreams's state ERROR (/health returned with HTTP code 503).
  • Otherwhise, the status for the service is set to UNKNOWN (/health returned with HTTP code 200).

Internally, Azkarra encapsualtes the KafkaStreams instance into the KafkaStreamsContainer class which has a state() method aware of state store recovery. Since Azkarra 0.9, the container will return the the following states during state-store recovering process: STATE_RESTORE_START, STATE_RESTORE_IN_PROGRESS, STATE_RESTORE_COMPLETED.

So, to solve your issue I think you have two solutions :

  1. You can implement and register an additional HealthIndicator that will set the status DOWN whenever the Kafka Streams state is not RUNNING.

  2. You can implement and register a custom JAX-RS resource to expose your own REST endpoints for liveness and readyness. See Azkarra REST Extensions. When implementinb an extension you can get an access to the AzkarraStreamsService to retrieve all KafkaStreamsContainer instance.

Hope this help!

from azkarra-streams.

marcospassos avatar marcospassos commented on June 15, 2024

I just checked it out, and it seems easy to implement a custom health check. Thank you!

One more question: how to register a custom HealthIndicator?

from azkarra-streams.

fhussonnois avatar fhussonnois commented on June 15, 2024

You can just annotate your class with @Component so that the class will be registered to the AzkarraContext. Then, the ApiHealthRoutes will look for all registered components that implement the HealthIndicator interface to build an aggregate HealthIndicator.

from azkarra-streams.

marcospassos avatar marcospassos commented on June 15, 2024

Is there any way to register programmatically (I mean, using the builder)?

from azkarra-streams.

fhussonnois avatar fhussonnois commented on June 15, 2024

Yes, you can just use the AzkarraContext#registerComponent method. Here is an example: https://github.com/streamthoughts/azkarra-streams/blob/master/azkarra-examples/src/main/java/io/streamthoughts/examples/azkarra/noannotation/StreamsApplication.java

Why don't you use the component scan mechanism ?

from azkarra-streams.

marcospassos avatar marcospassos commented on June 15, 2024

Oh, I see. We're just not a big fan of annotations :)

I'll try to implement the health check and bring some feedback.

Thanks!

from azkarra-streams.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.