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:04 UTC

(camel) 04/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 Servicebus

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 174eeaa4d27f1d601cbf59a7724650205d82444a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Jun 21 09:55:47 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 Servicebus
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../azure/servicebus/ServiceBusEndpoint.java       | 27 +++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java
index 066dc6d2445..087ca58dac5 100644
--- a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java
+++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java
@@ -22,9 +22,13 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.azure.servicebus.client.ServiceBusClientFactory;
+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;
 
 /**
  * Send and receive messages to/from Azure Service Bus.
@@ -33,7 +37,7 @@ import org.apache.camel.support.DefaultEndpoint;
              syntax = "azure-servicebus:topicOrQueueName", category = {
                      Category.CLOUD, Category.MESSAGING },
              headersClass = ServiceBusConstants.class)
-public class ServiceBusEndpoint extends DefaultEndpoint {
+public class ServiceBusEndpoint extends DefaultEndpoint implements EndpointServiceLocation {
 
     @UriParam
     private ServiceBusConfiguration configuration;
@@ -78,4 +82,25 @@ public class ServiceBusEndpoint extends DefaultEndpoint {
     public void setServiceBusClientFactory(ServiceBusClientFactory serviceBusClientFactory) {
         this.serviceBusClientFactory = serviceBusClientFactory;
     }
+
+    @Override
+    public String getServiceUrl() {
+        if (ObjectHelper.isNotEmpty(configuration.getFullyQualifiedNamespace())) {
+            return configuration.getFullyQualifiedNamespace();
+        }
+        return null;
+    }
+
+    @Override
+    public String getServiceProtocol() {
+        return "servicebus";
+    }
+
+    @Override
+    public Map<String, String> getServiceMetadata() {
+        if (configuration.getTopicOrQueueName() != null) {
+            return Map.of("topic-or-queue-name", configuration.getTopicOrQueueName());
+        }
+        return null;
+    }
 }