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 2024/06/19 12:59:39 UTC

(camel) branch CAMEL-20798-azure created (now 0d5b35d1241)

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

acosentino pushed a change to branch CAMEL-20798-azure
in repository https://gitbox.apache.org/repos/asf/camel.git


      at 0d5b35d1241 CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - Azure CosmosDB

This branch includes the following new commits:

     new fd1592c321d CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - Azure CosmosDB
     new 0d5b35d1241 CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - Azure CosmosDB

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel) 02/02: CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - Azure CosmosDB

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-20798-azure
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0d5b35d1241658cb214e82084a4eb0b121c4e9a0
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jun 19 14:59:13 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 - Azure CosmosDB
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java
index e7efc3efd91..59e6df3fedf 100644
--- a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java
+++ b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.azure.cosmosdb;
 
+import java.util.Map;
+
 import com.azure.cosmos.CosmosAsyncClient;
 import org.apache.camel.Category;
 import org.apache.camel.Component;
@@ -29,8 +31,6 @@ import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.util.ObjectHelper;
 
-import java.util.Map;
-
 /**
  * To read and write records to the CosmosDB database on Azure cloud platform.
  */


(camel) 01/02: CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - Azure CosmosDB

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-20798-azure
in repository https://gitbox.apache.org/repos/asf/camel.git

commit fd1592c321df46051db04f93ca76157aa141eede
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jun 19 11:24:20 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 - Azure CosmosDB
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../component/azure/cosmosdb/CosmosDbEndpoint.java | 26 +++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java
index 1fd8265abaf..e7efc3efd91 100644
--- a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java
+++ b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpoint.java
@@ -23,18 +23,21 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.azure.cosmosdb.client.CosmosDbClientFactory;
+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;
+
 /**
  * To read and write records to the CosmosDB database on Azure cloud platform.
  */
 @UriEndpoint(firstVersion = "3.10.0", scheme = "azure-cosmosdb", title = "Azure CosmosDB",
              syntax = "azure-cosmosdb:databaseName/containerName", category = {
                      Category.CLOUD, Category.DATABASE })
-public class CosmosDbEndpoint extends DefaultEndpoint {
+public class CosmosDbEndpoint extends DefaultEndpoint implements EndpointServiceLocation {
 
     @UriParam
     private CosmosDbConfiguration configuration;
@@ -104,4 +107,25 @@ public class CosmosDbEndpoint extends DefaultEndpoint {
     public void setCosmosAsyncClient(CosmosAsyncClient cosmosAsyncClient) {
         this.cosmosAsyncClient = cosmosAsyncClient;
     }
+
+    @Override
+    public String getServiceUrl() {
+        if (ObjectHelper.isNotEmpty(configuration.getDatabaseEndpoint())) {
+            return configuration.getDatabaseEndpoint();
+        }
+        return null;
+    }
+
+    @Override
+    public String getServiceProtocol() {
+        return "cosmosdb";
+    }
+
+    @Override
+    public Map<String, String> getServiceMetadata() {
+        if (configuration.getDatabaseName() != null) {
+            return Map.of("databaseName", configuration.getDatabaseName());
+        }
+        return null;
+    }
 }