You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/04 05:06:08 UTC

[GitHub] [camel] davsclaus commented on a diff in pull request #7336: CAMEL-17885 camel google bigquery: Allow to read service account key file from resolver

davsclaus commented on code in PR #7336:
URL: https://github.com/apache/camel/pull/7336#discussion_r841368425


##########
components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConfiguration.java:
##########
@@ -16,29 +16,39 @@
  */
 package org.apache.camel.component.google.bigquery;
 
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import org.apache.camel.spi.UriPath;
 
 @UriParams
-public class GoogleBigQueryConfiguration {
+public class GoogleBigQueryConfiguration implements Cloneable {
 
     @UriParam(description = "ConnectionFactory to obtain connection to Bigquery Service. If not provided the default one will be used")
     @Metadata(autowired = true)
     private GoogleBigQueryConnectionFactory connectionFactory;
+
     @UriParam(description = "Field name to use as insert id")
     private String useAsInsertId;
+
     @UriPath(label = "common", description = "Google Cloud Project Id")
     @Metadata(required = true)
     private String projectId;
+
     @UriPath(label = "common", description = "BigQuery Dataset Id")
     @Metadata(required = true)
     private String datasetId;
+
     @UriPath(label = "common", description = "BigQuery table id")
     @Metadata(required = false)
     private String tableId;
 
+    @UriParam(label = "common",

Review Comment:
   label = "security"



##########
components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/sql/GoogleBigQuerySQLConfiguration.java:
##########
@@ -16,25 +16,33 @@
  */
 package org.apache.camel.component.google.bigquery.sql;
 
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.google.bigquery.GoogleBigQueryConnectionFactory;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import org.apache.camel.spi.UriPath;
 
 @UriParams
-public class GoogleBigQuerySQLConfiguration {
+public class GoogleBigQuerySQLConfiguration implements Cloneable {
 
     @UriParam(description = "ConnectionFactory to obtain connection to Bigquery Service. If not provided the default one will be used")
     @Metadata(autowired = true)
     private GoogleBigQueryConnectionFactory connectionFactory;
+
     @UriPath(label = "common", description = "Google Cloud Project Id")
     @Metadata(required = true)
     private String projectId;
+
     @UriPath(label = "common", description = "BigQuery standard SQL query")
     @Metadata(required = true)
     private String queryString;
 
+    @UriParam(label = "common",

Review Comment:
   label = "security"



##########
components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryEndpoint.java:
##########
@@ -55,7 +55,14 @@ protected GoogleBigQueryEndpoint(String endpointUri, GoogleBigQueryComponent com
 
     @Override
     public Producer createProducer() throws Exception {
-        BigQuery bigquery = getConfiguration().getConnectionFactory().getDefaultClient();
+        GoogleBigQueryConnectionFactory connFactory = configuration.getConnectionFactory();
+        if (connFactory == null) {
+            connFactory = new GoogleBigQueryConnectionFactory()

Review Comment:
   It is better to move such logic (connFactory == null) block to doStart so the producer is not changing endpoint configuration.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org