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 e9432f202b6 CAMEL-19409: Allow clients to manually restart the
subscription (#10286)
e9432f202b6 is described below
commit e9432f202b62e4e813a0d3b75342557b7b7e8667
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Jun 13 09:19:20 2023 +0200
CAMEL-19409: Allow clients to manually restart the subscription (#10286)
---
.../camel/component/salesforce/SalesforceConsumer.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
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 7e5ea72a58a..87009871cbf 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
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.camel.Service;
import org.apache.camel.component.salesforce.api.SalesforceException;
import org.apache.camel.component.salesforce.api.dto.PlatformEvent;
import org.apache.camel.component.salesforce.api.utils.JsonUtils;
@@ -295,19 +296,23 @@ public class SalesforceConsumer extends DefaultConsumer {
}
/**
- * If alsoStopSubscription is added, any underlying subscriptions will be
stopped as well.
+ * Stops this consumer.
*
+ * If alsoStopSubscription=true, any underlying subscriptions will be
stopped as well.
* SubscriptionHelper also logs out, so this will terminate the salesforce
session as well.
*
- * @param alsoStopSubscription
+ * @param alsoStopSubscription to also stop subscription
*/
public void stop(boolean alsoStopSubscription) {
+ if (alsoStopSubscription) {
+ LOG.info("Force stopping Consumer and SubscriptionHelper");
+ }
stop();
if (alsoStopSubscription) {
try {
- subscriptionHelper.stop();
+ ServiceHelper.stopService(subscriptionHelper);
} catch (Exception e) {
- LOG.warn("Failed to stop subscription due to: {}",
e.getMessage(), e);
+ LOG.warn("Failed to stop subscription due to: {}. This
exception is ignored.", e.getMessage(), e);
}
}
}