This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 022db35  CAMEL-17839: camel-health - Allow to configure initial state 
of health-checks (readiness). This mostly affect scheduled consumers which can 
be in either DOWN or UNKNOWN state before doing their first poll. By default we 
are careful and report as DOWN as we are not ready. But this allows users to 
not care and set it as UP or UNKNOWN.
022db35 is described below

commit 022db35210eb5d0117654bba1d43db28b1044dc4
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Mar 24 18:07:27 2022 +0100

    CAMEL-17839: camel-health - Allow to configure initial state of 
health-checks (readiness). This mostly affect scheduled consumers which can be 
in either DOWN or UNKNOWN state before doing their first poll. By default we 
are careful and report as DOWN as we are not ready. But this allows users to 
not care and set it as UP or UNKNOWN.
---
 .../java/org/apache/camel/support/ScheduledPollConsumerHealthCheck.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumerHealthCheck.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumerHealthCheck.java
index 089e04f..4148603 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumerHealthCheck.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumerHealthCheck.java
@@ -38,7 +38,7 @@ public class ScheduledPollConsumerHealthCheck implements 
HealthCheck {
 
     public ScheduledPollConsumerHealthCheck(ScheduledPollConsumer consumer, 
String id) {
         this.registry = 
HealthCheckRegistry.get(consumer.getEndpoint().getCamelContext());
-        this.initialState = registry.getInitialState();
+        this.initialState = registry != null ? registry.getInitialState() : 
State.DOWN;
         this.consumer = consumer;
         this.id = id;
         this.sanitizedBaseUri = 
URISupport.sanitizeUri(consumer.getEndpoint().getEndpointBaseUri());

Reply via email to