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
commit 1a08bfbf552bf2ea9357d36cab742de4994330ce 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/StreamingApiConsumer.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/StreamingApiConsumer.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/StreamingApiConsumer.java index 0035bfadbde..954334ebb40 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/StreamingApiConsumer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/StreamingApiConsumer.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; @@ -297,19 +298,23 @@ public class StreamingApiConsumer 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); } } }
