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/21 08:33:06 UTC

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

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

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

commit ee3b3dd81b7a07d566c35e267bc89b0f21668d3d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Jun 21 10:11:12 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 Storage Datalake
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../component/azure/storage/blob/BlobEndpoint.java |  2 +-
 .../azure/storage/datalake/DataLakeEndpoint.java   | 26 +++++++++++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobEndpoint.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobEndpoint.java
index 3b483289852..7db8eb29ca7 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobEndpoint.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobEndpoint.java
@@ -124,7 +124,7 @@ public class BlobEndpoint extends ScheduledPollEndpoint implements EndpointServi
 
     @Override
     public String getServiceProtocol() {
-        return "azure-storage-blob";
+        return "storage-blob";
     }
 
     @Override
diff --git a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeEndpoint.java b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeEndpoint.java
index cf7f46d067c..f0f54ca34b4 100644
--- a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeEndpoint.java
+++ b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeEndpoint.java
@@ -26,9 +26,13 @@ import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.azure.storage.datalake.client.DataLakeClientFactory;
 import org.apache.camel.component.azure.storage.datalake.operations.DataLakeOperationResponse;
+import org.apache.camel.spi.EndpointServiceLocation;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.ScheduledPollEndpoint;
+import org.apache.camel.util.ObjectHelper;
+
+import java.util.Map;
 
 /**
  * Sends and receives files to/from Azure Data Lake Storage.
@@ -36,7 +40,7 @@ import org.apache.camel.support.ScheduledPollEndpoint;
 @UriEndpoint(firstVersion = "3.8.0", scheme = "azure-storage-datalake", title = "Azure Storage Data Lake Service",
              syntax = "azure-storage-datalake:accountName/fileSystemName",
              category = { Category.CLOUD, Category.FILE, Category.BIGDATA }, headersClass = DataLakeConstants.class)
-public class DataLakeEndpoint extends ScheduledPollEndpoint {
+public class DataLakeEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation {
 
     @UriParam(description = "service client of data lake")
     private DataLakeServiceClient dataLakeServiceClient;
@@ -97,4 +101,24 @@ public class DataLakeEndpoint extends ScheduledPollEndpoint {
         }
     }
 
+    @Override
+    public String getServiceUrl() {
+        if (ObjectHelper.isNotEmpty(configuration.getFileSystemName())) {
+            return configuration.getFileSystemName();
+        }
+        return null;
+    }
+
+    @Override
+    public String getServiceProtocol() {
+        return "datalake";
+    }
+
+    @Override
+    public Map<String, String> getServiceMetadata() {
+        if (ObjectHelper.isNotEmpty(configuration.getAccountName())) {
+            return Map.of("account", configuration.getAccountName());
+        }
+        return null;
+    }
 }