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

davsclaus 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 5acb57ce006 CAMEL-19409: Allow clients to manually restart the 
subscription (#10286)
5acb57ce006 is described below

commit 5acb57ce006c3117a568b56dc15b54b5a035cb04
Author: Jesse Sightler <[email protected]>
AuthorDate: Tue Jun 13 03:07:18 2023 -0400

    CAMEL-19409: Allow clients to manually restart the subscription (#10286)
    
    * CAMEL-19409: Allow clients to manually restart the subscription
    
    * Fixed log line
    
    * Fixed concatenation of the error string
---
 .../component/salesforce/SalesforceConsumer.java   | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceConsumer.java
 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceConsumer.java
index bda83acabb9..7e5ea72a58a 100644
--- 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceConsumer.java
+++ 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceConsumer.java
@@ -108,6 +108,10 @@ public class SalesforceConsumer extends DefaultConsumer {
         return topicName;
     }
 
+    public SubscriptionHelper getSubscriptionHelper() {
+        return subscriptionHelper;
+    }
+
     @Override
     public void handleException(String message, Throwable t) {
         super.handleException(message, t);
@@ -290,6 +294,24 @@ public class SalesforceConsumer extends DefaultConsumer {
         subscribed = true;
     }
 
+    /**
+     * If alsoStopSubscription is added, any underlying subscriptions will be 
stopped as well.
+     *
+     * SubscriptionHelper also logs out, so this will terminate the salesforce 
session as well.
+     *
+     * @param alsoStopSubscription
+     */
+    public void stop(boolean alsoStopSubscription) {
+        stop();
+        if (alsoStopSubscription) {
+            try {
+                subscriptionHelper.stop();
+            } catch (Exception e) {
+                LOG.warn("Failed to stop subscription due to: {}", 
e.getMessage(), e);
+            }
+        }
+    }
+
     @Override
     protected void doStop() throws Exception {
         super.doStop();

Reply via email to