Skip to content

Commit

Permalink
Update ProbeService.java readiness to report ready only if the applic…
Browse files Browse the repository at this point in the history
…ation is running (#133)

In kubernetes, readiness are used to determine if a loadbalancer can forward request to a pod.
If a pod declare that he is ready, he will receive traffic.

The readiness for a kafka stream application is useful if we want to deploy a rest endpoint on top of it like an interactive query. (https://docs.confluent.io/platform/current/streams/developer-guide/interactive-queries.html)
In such a case, we do not want a pod to pretend that it is ready if it is rebalancing, since it is potentially transferring state stores and therefore a potentially inconsistent state.
  • Loading branch information
Jsebayhi authored Nov 27, 2023
1 parent dc55c3a commit 898d21f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static RestServiceResponse<String> readinessProbe(
}
}

return kafkaStreamsInitializer.getKafkaStreams().state().isRunningOrRebalancing()
return kafkaStreamsInitializer.getKafkaStreams().state().equals(KafkaStreams.State.RUNNING)
? RestServiceResponse.<String>builder().status(HttpURLConnection.HTTP_OK).build() :
RestServiceResponse.<String>builder().status(HttpURLConnection.HTTP_UNAVAILABLE)
.build();
Expand Down

0 comments on commit 898d21f

Please sign in to comment.