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

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


The following commit(s) were added to refs/heads/camel-4.18.x by this push:
     new d94bd8c2dda2 CAMEL-24284: Reset recoverTask after successful SJMS 
connection recovery
d94bd8c2dda2 is described below

commit d94bd8c2dda26a9bfc1d27be094c2c01f11d7a1c
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Aug 3 08:52:42 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 #25288
    
    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