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

davsclaus pushed a commit to branch backport/25283-to-camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 7682cf9e7f0ed4b04822b98914948d746348d1ed
Author: GaĆ«lle Fournier <[email protected]>
AuthorDate: Mon Aug 3 08:03:37 2026 +0200

    CAMEL-24284: Reset recoverTask after successful SJMS connection recovery
    
    Fix a bug where the SJMS consumer becomes permanently dead after
    recovering from a JMS connection failure once. BackgroundTask.schedule()
    sets running=true but never resets it, so the re-scheduling guard
    permanently blocks after the first successful recovery. Reset
    recoverTask and recoverFuture to null after successful recovery to
    re-arm the mechanism for subsequent failures.
    
    Closes #25283
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../sjms/consumer/SimpleMessageListenerContainer.java          | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/SimpleMessageListenerContainer.java
 
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/SimpleMessageListenerContainer.java
index 3752fe636f43..932e6e8f3512 100644
--- 
a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/SimpleMessageListenerContainer.java
+++ 
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/SimpleMessageListenerContainer.java
@@ -203,6 +203,16 @@ public class SimpleMessageListenerContainer extends 
ServiceSupport
         try {
             refreshConnection();
             initConsumers();
+            connectionLock.lock();
+            try {
+                if (recoverFuture != null) {
+                    recoverFuture.cancel(false);
+                }
+                recoverTask = null;
+                recoverFuture = null;
+            } finally {
+                connectionLock.unlock();
+            }
             LOG.debug("Successfully recovered JMS Connection (attempt: {})", 
task.iteration());
             // success so do not try again
             return true;

Reply via email to