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

acosentino pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.x by this push:
     new 77a2bab9613 CAMEL-20092: reset error counter before greedy poll 
(#11937) (#11949)
77a2bab9613 is described below

commit 77a2bab96132735e740345975eaf9f7020720aa3
Author: Simon Oxenvad Rasmussen <[email protected]>
AuthorDate: Thu Nov 9 11:46:04 2023 +0100

    CAMEL-20092: reset error counter before greedy poll (#11937) (#11949)
    
    ScheduledPollConsumerHealthCheck uses the error count to determine if
    the consumer is healthly or not. After polling messages, we know that
    the consumer is healthy, and it is safe to reset the error markers.
---
 .../main/java/org/apache/camel/support/ScheduledPollConsumer.java   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
index c12bfc67158..d3a611cb984 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
@@ -214,6 +214,12 @@ public abstract class ScheduledPollConsumer extends 
DefaultConsumer
                                 retryCounter = -1;
                                 LOG.trace("Greedy polling after processing {} 
messages", polledMessages);
 
+                                // clear any error that might be since we have 
successfully polled, otherwise readiness checks might believe the
+                                // consumer to be unhealthy
+                                errorCounter = 0;
+                                lastError = null;
+                                lastErrorDetails = null;
+
                                 // setting firstPollDone to true if greedy 
polling is enabled
                                 firstPollDone = true;
                             }

Reply via email to