You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/08/03 06:03:44 UTC

(camel) branch main updated: CAMEL-24284: Reset recoverTask after successful SJMS connection recovery

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 79d931ab9ee0 CAMEL-24284: Reset recoverTask after successful SJMS connection recovery
79d931ab9ee0 is described below

commit 79d931ab9ee002c0e298ea52b5e18142b4e983e2
Author: Gaƫlle Fournier <ga...@gmail.com>
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 <no...@anthropic.com>
---
 .../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 295b7717dacc..64657e6f2a64 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
@@ -205,6 +205,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;