You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/03/04 08:50:39 UTC

[camel] 01/03: CAMEL-16273 - Camel-google-* cloud components: Make the serviceAccountKey explicitly configurable - Camel-google-pubsub, add service account key at component level

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

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

commit 449a8adcd8552b69c74ae0ac4e5eb6f7857f5eb9
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Mar 4 09:30:44 2021 +0100

    CAMEL-16273 - Camel-google-* cloud components: Make the serviceAccountKey explicitly configurable - Camel-google-pubsub, add service account key at component level
---
 .../component/google/pubsub/GooglePubsubComponent.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java
index dbc2aca..c0442b4 100644
--- a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java
+++ b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java
@@ -61,6 +61,12 @@ public class GooglePubsubComponent extends DefaultComponent {
               description = "Endpoint to use with local Pub/Sub emulator.")
     private String endpoint;
 
+    @Metadata(label = "common",
+              description = "The Service account key that can be used as credentials for the PubSub publisher/subscriber. It can be loaded by default from "
+                  + " classpath, but you can prefix with classpath:, file:, or http: to load the resource from different systems.",
+                  required = true)
+    private String serviceAccountKey;
+
     @Metadata(
               label = "producer",
               description = "Maximum number of producers to cache. This could be increased if you have producers for lots of different topics.")
@@ -111,6 +117,7 @@ public class GooglePubsubComponent extends DefaultComponent {
         GooglePubsubEndpoint pubsubEndpoint = new GooglePubsubEndpoint(uri, this, remaining);
         pubsubEndpoint.setProjectId(parts[0]);
         pubsubEndpoint.setDestinationName(parts[1]);
+        pubsubEndpoint.setServiceAccountKey(serviceAccountKey);
 
         setProperties(pubsubEndpoint, parameters);
 
@@ -234,4 +241,12 @@ public class GooglePubsubComponent extends DefaultComponent {
     public void setPublisherTerminationTimeout(int publisherTerminationTimeout) {
         this.publisherTerminationTimeout = publisherTerminationTimeout;
     }
+
+    public String getServiceAccountKey() {
+        return serviceAccountKey;
+    }
+
+    public void setServiceAccountKey(String serviceAccountKey) {
+        this.serviceAccountKey = serviceAccountKey;
+    }
 }