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

oalsafi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 31531a4  CAMEL-15064: initialize the subscription name in the 
constructor in order to avoid thread termination (#3836)
31531a4 is described below

commit 31531a408db1b65379e924c585c15d009bced73e
Author: Omar Al-Safi <omars...@gmail.com>
AuthorDate: Mon May 18 13:13:31 2020 +0200

    CAMEL-15064: initialize the subscription name in the constructor in order 
to avoid thread termination (#3836)
---
 .../camel/component/google/pubsub/GooglePubsubConsumer.java      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java
 
b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java
index 74ff6f4..c411ba8 100644
--- 
a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java
+++ 
b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java
@@ -96,16 +96,19 @@ class GooglePubsubConsumer extends DefaultConsumer {
 
     private class SubscriberWrapper implements Runnable {
 
+        private final String subscriptionName;
+
+        SubscriberWrapper() {
+            subscriptionName = 
ProjectSubscriptionName.format(endpoint.getProjectId(), 
endpoint.getDestinationName());
+        }
+
         @Override
         public void run() {
             try {
-                String subscriptionName = 
ProjectSubscriptionName.format(endpoint.getProjectId(), 
endpoint.getDestinationName());
-
                 if (localLog.isDebugEnabled()) {
                     localLog.debug("Subscribing to {}", subscriptionName);
                 }
 
-
                 if (endpoint.isSynchronousPull()) {
                     synchronousPull(subscriptionName);
                 } else {

Reply via email to