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:40 UTC
(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
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;
+ }
}