This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch CAMEL-20798-gcp in repository https://gitbox.apache.org/repos/asf/camel.git
commit 326e81913ef912b97709bf737b4d7fa515d9c1bc Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Jun 28 10:44:35 2024 +0200 CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - Google Big Query Signed-off-by: Andrea Cosentino <anco...@gmail.com> --- .../google/bigquery/GoogleBigQueryEndpoint.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryEndpoint.java b/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryEndpoint.java index 1d9d331164f..948a51468cd 100644 --- a/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryEndpoint.java +++ b/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryEndpoint.java @@ -21,9 +21,13 @@ import org.apache.camel.Category; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; +import org.apache.camel.util.ObjectHelper; + +import java.util.Map; import static org.apache.camel.component.google.bigquery.GoogleBigQueryConstants.SCHEME_BIGQUERY; @@ -42,7 +46,7 @@ import static org.apache.camel.component.google.bigquery.GoogleBigQueryConstants @UriEndpoint(firstVersion = "2.20.0", scheme = SCHEME_BIGQUERY, title = "Google BigQuery", syntax = "google-bigquery:projectId:datasetId:tableId", category = { Category.CLOUD, Category.BIGDATA }, producerOnly = true, headersClass = GoogleBigQueryConstants.class) -public class GoogleBigQueryEndpoint extends DefaultEndpoint { +public class GoogleBigQueryEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriParam protected final GoogleBigQueryConfiguration configuration; @@ -87,4 +91,16 @@ public class GoogleBigQueryEndpoint extends DefaultEndpoint { return (GoogleBigQueryComponent) super.getComponent(); } + @Override + public String getServiceUrl() { + if (ObjectHelper.isNotEmpty(configuration.getProjectId()) && ObjectHelper.isNotEmpty(configuration.getDatasetId()) && ObjectHelper.isNotEmpty(configuration.getTableId())) { + return getServiceProtocol() + ":" + configuration.getProjectId() + ":" + configuration.getDatasetId() + ":" + configuration.getTableId(); + } + return null; + } + + @Override + public String getServiceProtocol() { + return "big-query"; + } }