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 c637230e962b14952d5458acae5a3488ecbb348c 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/StreamingApiConsumer.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 04ba2979848..0035bfadbde 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 @@ -108,6 +108,10 @@ public class StreamingApiConsumer extends DefaultConsumer { return topicName; } + public SubscriptionHelper getSubscriptionHelper() { + return subscriptionHelper; + } + @Override public void handleException(String message, Throwable t) { super.handleException(message, t); @@ -292,6 +296,24 @@ public class StreamingApiConsumer 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();
