This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch ra in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3a8311193df8f87cfbd68aaba26210e464ac4c80 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon May 27 12:43:02 2024 +0200 CAMEL-20798: Add RemoteAddress to endpoints so they can tell the url/hostname etc for the system it connects. This is needed for better monitoring, tracing and management. Add this information into camel-tracer as tags. --- .../camel/component/activemq/ActiveMQEndpoint.java | 4 ++-- .../camel/component/activemq6/ActiveMQEndpoint.java | 4 ++-- .../camel/component/arangodb/ArangoDbEndpoint.java | 4 ++-- .../camel/component/asterisk/AsteriskEndpoint.java | 4 ++-- .../camel/component/bonita/BonitaEndpoint.java | 13 +++++++++---- .../camel/component/cassandra/CassandraEndpoint.java | 13 +++++++++---- .../org/apache/camel/component/cm/CMEndpoint.java | 11 ++++++++--- .../java/org/apache/camel/coap/CoAPEndpoint.java | 14 +++++++++++--- .../camel/component/cometd/CometdEndpoint.java | 11 ++++++++--- .../camel/component/couchbase/CouchbaseEndpoint.java | 13 +++++++++---- .../camel/component/couchdb/CouchDbEndpoint.java | 13 +++++++++---- .../rest/client/ElasticsearchRestClientEndpoint.java | 11 ++++++++--- .../camel/component/es/ElasticsearchEndpoint.java | 11 ++++++++--- .../apache/camel/component/fhir/FhirEndpoint.java | 13 +++++++++---- .../component/file/remote/RemoteFileEndpoint.java | 13 +++++++++---- .../apache/camel/http/common/HttpCommonEndpoint.java | 4 ++-- .../infinispan/remote/InfinispanRemoteEndpoint.java | 20 +++++++++++++++++--- .../camel/component/ironmq/IronMQEndpoint.java | 11 ++++++++--- .../apache/camel/component/kafka/KafkaEndpoint.java | 13 +++++++++---- .../apache/camel/component/kudu/KuduEndpoint.java | 11 ++++++++--- .../camel/component/lucene/LuceneEndpoint.java | 11 ++++++++--- .../apache/camel/component/mail/MailEndpoint.java | 4 ++-- .../apache/camel/component/mllp/MllpEndpoint.java | 11 ++++++++--- .../apache/camel/component/nats/NatsEndpoint.java | 11 ++++++++--- .../apache/camel/component/netty/NettyEndpoint.java | 11 ++++++++--- .../component/opensearch/OpensearchEndpoint.java | 11 ++++++++--- .../component/paho/mqtt5/PahoMqtt5Endpoint.java | 13 +++++++++---- .../apache/camel/component/paho/PahoEndpoint.java | 13 +++++++++---- .../platform/http/PlatformHttpEndpoint.java | 6 +++--- .../camel/component/pulsar/PulsarEndpoint.java | 11 ++++++++--- .../camel/component/rocketmq/RocketMQEndpoint.java | 11 ++++++++--- .../component/sap/netweaver/NetWeaverEndpoint.java | 4 ++-- .../org/apache/camel/component/smb/SmbEndpoint.java | 13 +++++++++---- .../apache/camel/component/smpp/SmppEndpoint.java | 11 ++++++++--- .../apache/camel/component/snmp/SnmpEndpoint.java | 11 ++++++++--- .../camel/component/splunkhec/SplunkHECEndpoint.java | 11 ++++++++--- .../camel/component/splunk/SplunkEndpoint.java | 13 +++++++++---- .../springrabbit/SpringRabbitMQEndpoint.java | 13 +++++++++---- .../apache/camel/component/redis/RedisEndpoint.java | 11 ++++++++--- .../camel/component/sql/DefaultSqlEndpoint.java | 13 +++++++++---- .../org/apache/camel/component/ssh/SshEndpoint.java | 13 +++++++++---- .../apache/camel/component/stomp/StompEndpoint.java | 13 +++++++++---- .../tracing/decorators/AbstractSpanDecorator.java | 8 ++++---- .../component/vertx/http/VertxHttpEndpoint.java | 11 ++++++++--- .../vertx/websocket/VertxWebsocketEndpoint.java | 11 ++++++++--- 45 files changed, 336 insertions(+), 144 deletions(-) diff --git a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/ActiveMQEndpoint.java b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/ActiveMQEndpoint.java index 12902718dc1..df6ff18bec8 100644 --- a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/ActiveMQEndpoint.java +++ b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/ActiveMQEndpoint.java @@ -24,7 +24,7 @@ import org.apache.camel.component.jms.JmsBinding; import org.apache.camel.component.jms.JmsComponent; import org.apache.camel.component.jms.JmsConfiguration; import org.apache.camel.component.jms.JmsEndpoint; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -34,7 +34,7 @@ import org.apache.camel.spi.UriParam; @UriEndpoint(firstVersion = "1.0.0", extendsScheme = "jms", scheme = "activemq", title = "ActiveMQ 5.x", syntax = "activemq:destinationType:destinationName", category = { Category.MESSAGING }) -public class ActiveMQEndpoint extends JmsEndpoint implements EndpointLocationAddress { +public class ActiveMQEndpoint extends JmsEndpoint implements EndpointServiceLocation { @UriParam(multiValue = true, prefix = "destination.", label = "consumer,advanced") private Map<String, String> destinationOptions; diff --git a/components/camel-activemq6/src/main/java/org/apache/camel/component/activemq6/ActiveMQEndpoint.java b/components/camel-activemq6/src/main/java/org/apache/camel/component/activemq6/ActiveMQEndpoint.java index 336d3a04c48..213ac637fa0 100644 --- a/components/camel-activemq6/src/main/java/org/apache/camel/component/activemq6/ActiveMQEndpoint.java +++ b/components/camel-activemq6/src/main/java/org/apache/camel/component/activemq6/ActiveMQEndpoint.java @@ -24,7 +24,7 @@ import org.apache.camel.component.jms.JmsBinding; import org.apache.camel.component.jms.JmsComponent; import org.apache.camel.component.jms.JmsConfiguration; import org.apache.camel.component.jms.JmsEndpoint; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -34,7 +34,7 @@ import org.apache.camel.spi.UriParam; @UriEndpoint(firstVersion = "4.7.0", extendsScheme = "jms", scheme = "activemq6", title = "ActiveMQ 6.x", syntax = "activemq6:destinationType:destinationName", category = { Category.MESSAGING }) -public class ActiveMQEndpoint extends JmsEndpoint implements EndpointLocationAddress { +public class ActiveMQEndpoint extends JmsEndpoint implements EndpointServiceLocation { @UriParam(multiValue = true, prefix = "destination.", label = "consumer,advanced") private Map<String, String> destinationOptions; diff --git a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java index a64b08b8b79..be31887d278 100644 --- a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java +++ b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java @@ -21,7 +21,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,7 +36,7 @@ import java.util.Map; */ @UriEndpoint(firstVersion = "3.5.0", scheme = "arangodb", title = "ArangoDb", syntax = "arangodb:database", category = { Category.DATABASE }, producerOnly = true, headersClass = ArangoDbConstants.class) -public class ArangoDbEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class ArangoDbEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriPath(description = "database name") @Metadata(required = true) diff --git a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java index 4fb8928e640..613a7791c43 100644 --- a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java +++ b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,7 +35,7 @@ import java.util.Map; */ @UriEndpoint(firstVersion = "2.18.0", scheme = "asterisk", title = "Asterisk", syntax = "asterisk:name", category = { Category.MOBILE }, headersClass = AsteriskConstants.class) -public class AsteriskEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class AsteriskEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriPath(description = "Name of component") @Metadata(required = true) private String name; diff --git a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java index 4db5622e7f9..c24206e361c 100644 --- a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java +++ b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java @@ -25,7 +25,7 @@ import org.apache.camel.Producer; import org.apache.camel.component.bonita.exception.BonitaException; import org.apache.camel.component.bonita.producer.BonitaStartProducer; import org.apache.camel.component.bonita.util.BonitaOperation; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -35,7 +35,7 @@ import org.apache.camel.support.DefaultEndpoint; */ @UriEndpoint(firstVersion = "2.19.0", scheme = "bonita", title = "Bonita", syntax = "bonita:operation", producerOnly = true, category = { Category.WORKFLOW }) -public class BonitaEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class BonitaEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriParam private BonitaConfiguration configuration; @@ -47,12 +47,17 @@ public class BonitaEndpoint extends DefaultEndpoint implements EndpointLocationA } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getHostname() + ":" + configuration.getPort(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "rest"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (configuration.getUsername() != null) { return Map.of("username", configuration.getUsername()); } diff --git a/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java b/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java index 8ded8f138c3..ba94a025e5a 100644 --- a/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java +++ b/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraEndpoint.java @@ -35,7 +35,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; @@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory; */ @UriEndpoint(firstVersion = "2.15.0", scheme = "cql", title = "Cassandra CQL", syntax = "cql:beanRef:hosts:port/keyspace", category = { Category.DATABASE, Category.BIGDATA }, headersClass = CassandraConstants.class) -public class CassandraEndpoint extends ScheduledPollEndpoint implements EndpointLocationAddress { +public class CassandraEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(CassandraEndpoint.class); private volatile CassandraSessionHolder sessionHolder; @@ -99,7 +99,7 @@ public class CassandraEndpoint extends ScheduledPollEndpoint implements Endpoint } @Override - public String getAddress() { + public String getServiceUrl() { if (hosts != null && port != null) { return hosts + ":" + port; } else if (hosts != null) { @@ -109,7 +109,12 @@ public class CassandraEndpoint extends ScheduledPollEndpoint implements Endpoint } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "cql"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (username != null) { return Map.of("username", username); } diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java index 6580e7478b6..57c19f30148 100644 --- a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java +++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java @@ -22,7 +22,7 @@ import org.apache.camel.Category; import org.apache.camel.Consumer; import org.apache.camel.ExchangePattern; import org.apache.camel.Processor; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -38,7 +38,7 @@ import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; */ @UriEndpoint(firstVersion = "2.18.0", scheme = "cm-sms", title = "CM SMS Gateway", syntax = "cm-sms:host", category = { Category.MOBILE }, producerOnly = true) -public class CMEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class CMEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriPath @Metadata(required = true) @@ -84,10 +84,15 @@ public class CMEndpoint extends DefaultEndpoint implements EndpointLocationAddre } @Override - public String getAddress() { + public String getServiceUrl() { return host; } + @Override + public String getServiceProtocol() { + return "http"; + } + public CMConfiguration getConfiguration() { return configuration; } diff --git a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java index 5cec4e330b3..3ff695554e2 100644 --- a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java +++ b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java @@ -37,7 +37,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; @@ -76,7 +76,7 @@ import static org.eclipse.californium.scandium.config.DtlsConfig.DTLS_RECOMMENDE */ @UriEndpoint(firstVersion = "2.16.0", scheme = "coap,coaps,coap+tcp,coaps+tcp", title = "CoAP", syntax = "coap:uri", category = { Category.IOT }, headersClass = CoAPConstants.class) -public class CoAPEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class CoAPEndpoint extends DefaultEndpoint implements EndpointServiceLocation { final static Logger LOGGER = LoggerFactory.getLogger(CoAPEndpoint.class); @UriPath private URI uri; @@ -121,13 +121,21 @@ public class CoAPEndpoint extends DefaultEndpoint implements EndpointLocationAdd } @Override - public String getAddress() { + public String getServiceUrl() { if (uri != null) { return uri.toString(); } return null; } + @Override + public String getServiceProtocol() { + if (uri != null) { + return uri.getScheme(); + } + return null; + } + public void setCoapMethodRestrict(String coapMethodRestrict) { this.coapMethodRestrict = coapMethodRestrict; } diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java index f47a1dcf2f5..a731b7c86a6 100644 --- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java +++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java @@ -23,7 +23,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -39,7 +39,7 @@ import org.apache.camel.util.ObjectHelper; */ @UriEndpoint(firstVersion = "2.0.0", scheme = "cometd,cometds", title = "CometD", syntax = "cometd:host:port/channelName", category = { Category.NETWORKING, Category.MESSAGING }, headersClass = CometdBinding.class) -public class CometdEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class CometdEndpoint extends DefaultEndpoint implements EndpointServiceLocation { private CometdComponent component; @@ -92,10 +92,15 @@ public class CometdEndpoint extends DefaultEndpoint implements EndpointLocationA } @Override - public String getAddress() { + public String getServiceUrl() { return getProtocol() + ":" + host + ":" + getPort(); } + @Override + public String getServiceProtocol() { + return getProtocol(); + } + @Override public Producer createProducer() throws Exception { ObjectHelper.notNull(component, "component"); diff --git a/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java b/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java index 604c06660ac..db8835da91e 100644 --- a/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java +++ b/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java @@ -36,7 +36,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -59,7 +59,7 @@ import static org.apache.camel.component.couchbase.CouchbaseConstants.DEFAULT_VI */ @UriEndpoint(firstVersion = "2.19.0", scheme = "couchbase", title = "Couchbase", syntax = "couchbase:protocol://hostname:port", category = { Category.DATABASE }, headersClass = CouchbaseConstants.class) -public class CouchbaseEndpoint extends ScheduledPollEndpoint implements EndpointLocationAddress { +public class CouchbaseEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { @UriPath @Metadata(required = true) @@ -168,12 +168,17 @@ public class CouchbaseEndpoint extends ScheduledPollEndpoint implements Endpoint } @Override - public String getAddress() { + public String getServiceUrl() { return protocol + ":" + hostname + ":" + port; } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return protocol; + } + + @Override + public Map<String, String> getServiceMetadata() { if (username != null) { return Map.of("username", username); } diff --git a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java index 7419dd78788..f80c8bc9bd0 100644 --- a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java +++ b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java @@ -23,7 +23,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -37,7 +37,7 @@ import org.lightcouch.CouchDbClient; */ @UriEndpoint(firstVersion = "2.11.0", scheme = "couchdb", title = "CouchDB", syntax = "couchdb:protocol:hostname:port/database", category = { Category.DATABASE }, headersClass = CouchDbConstants.class) -public class CouchDbEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class CouchDbEndpoint extends DefaultEndpoint implements EndpointServiceLocation { public static final String DEFAULT_STYLE = "main_only"; public static final long DEFAULT_HEARTBEAT = 30000; @@ -99,12 +99,17 @@ public class CouchDbEndpoint extends DefaultEndpoint implements EndpointLocation } @Override - public String getAddress() { + public String getServiceUrl() { return getProtocol() + ":" + getHostname() + ":" + getPort(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return getProtocol(); + } + + @Override + public Map<String, String> getServiceMetadata() { if (username != null) { return Map.of("username", username); } diff --git a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java index eb13e8e283d..a8539febfa7 100644 --- a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java +++ b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,7 +36,7 @@ import org.elasticsearch.client.RestClient; title = "Elasticsearch Low level Rest Client", syntax = "elasticsearch-rest-client:clusterName", producerOnly = true, category = { Category.SEARCH }) -public class ElasticsearchRestClientEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class ElasticsearchRestClientEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriPath @Metadata(required = true) @@ -93,10 +93,15 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint implements } @Override - public String getAddress() { + public String getServiceUrl() { return getHostAddressesList(); } + @Override + public String getServiceProtocol() { + return "elasticsearch"; + } + /** * Cluster Name */ diff --git a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/es/ElasticsearchEndpoint.java b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/es/ElasticsearchEndpoint.java index 84d8d07acd3..1cfcddbe9e6 100644 --- a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/es/ElasticsearchEndpoint.java +++ b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/es/ElasticsearchEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -32,7 +32,7 @@ import org.elasticsearch.client.RestClient; @UriEndpoint(firstVersion = "3.19.0", scheme = "elasticsearch", title = "Elasticsearch", syntax = "elasticsearch:clusterName", producerOnly = true, category = { Category.SEARCH, Category.MONITORING }, headersClass = ElasticsearchConstants.class) -public class ElasticsearchEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class ElasticsearchEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriParam private final ElasticsearchConfiguration configuration; @@ -51,10 +51,15 @@ public class ElasticsearchEndpoint extends DefaultEndpoint implements EndpointLo } @Override - public String getAddress() { + public String getServiceUrl() { return getConfiguration().getHostAddresses(); } + @Override + public String getServiceProtocol() { + return "elasticsearch"; + } + @Override public Producer createProducer() { return new ElasticsearchProducer(this, configuration); diff --git a/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirEndpoint.java b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirEndpoint.java index 4c234815549..63cf1668105 100644 --- a/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirEndpoint.java +++ b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirEndpoint.java @@ -42,7 +42,7 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection; import org.apache.camel.component.fhir.internal.FhirApiName; import org.apache.camel.component.fhir.internal.FhirConstants; import org.apache.camel.component.fhir.internal.FhirPropertiesHelper; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.component.AbstractApiEndpoint; @@ -55,7 +55,7 @@ import org.apache.camel.support.component.ApiMethodPropertiesHelper; @UriEndpoint(firstVersion = "2.23.0", scheme = "fhir", title = "FHIR", syntax = "fhir:apiName/methodName", apiSyntax = "apiName/methodName", category = { Category.API }) -public class FhirEndpoint extends AbstractApiEndpoint<FhirApiName, FhirConfiguration> implements EndpointLocationAddress { +public class FhirEndpoint extends AbstractApiEndpoint<FhirApiName, FhirConfiguration> implements EndpointServiceLocation { private static final String EXTRA_PARAMETERS_PROPERTY = "extraParameters"; @@ -71,12 +71,17 @@ public class FhirEndpoint extends AbstractApiEndpoint<FhirApiName, FhirConfigura } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getServerUrl(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "fhir"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (configuration.getUsername() != null) { return Map.of("username", configuration.getUsername()); } diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java index 9f201a6640f..b2c095a1075 100644 --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java @@ -26,7 +26,7 @@ import org.apache.camel.component.file.GenericFileEndpoint; import org.apache.camel.component.file.GenericFileExist; import org.apache.camel.component.file.GenericFilePollingConsumer; import org.apache.camel.component.file.GenericFileProducer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriParam; import org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository; import org.apache.camel.util.StringHelper; @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; /** * Remote file endpoint. */ -public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T> implements EndpointLocationAddress { +public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T> implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(RemoteFileEndpoint.class); @@ -106,12 +106,17 @@ public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T> imple } @Override - public String getAddress() { + public String getServiceUrl() { return getConfiguration().getProtocol() + ":" + getConfiguration().getHost() + ":" + getConfiguration().getPort(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return getConfiguration().getProtocol(); + } + + @Override + public Map<String, String> getServiceMetadata() { if (getConfiguration().getUsername() != null) { return Map.of("username", getConfiguration().getUsername()); } diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java index 93d5c665042..88fe0c60fc4 100644 --- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java +++ b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java @@ -22,7 +22,7 @@ import java.util.Map; import org.apache.camel.cloud.DiscoverableService; import org.apache.camel.cloud.ServiceDefinition; import org.apache.camel.http.base.cookie.CookieHandler; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.spi.Metadata; @@ -31,7 +31,7 @@ import org.apache.camel.spi.UriPath; import org.apache.camel.support.DefaultEndpoint; import org.apache.camel.util.CollectionHelper; -public abstract class HttpCommonEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, DiscoverableService, EndpointLocationAddress { +public abstract class HttpCommonEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, DiscoverableService, EndpointServiceLocation { // Note: all options must be documented with description in annotations so extended components can access the documentation diff --git a/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java b/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java index a6be6293c9c..ed827d3c449 100644 --- a/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java +++ b/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java @@ -23,13 +23,14 @@ import org.apache.camel.Producer; import org.apache.camel.component.infinispan.InfinispanComponent; import org.apache.camel.component.infinispan.InfinispanConstants; import org.apache.camel.component.infinispan.InfinispanEndpoint; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; import org.apache.camel.support.service.ServiceHelper; +import java.util.Map; import java.util.StringJoiner; import static org.apache.camel.component.infinispan.InfinispanConstants.SCHEME_INFINISPAN; @@ -39,7 +40,7 @@ import static org.apache.camel.component.infinispan.InfinispanConstants.SCHEME_I */ @UriEndpoint(firstVersion = "2.13.0", scheme = SCHEME_INFINISPAN, title = "Infinispan", syntax = "infinispan:cacheName", category = { Category.CACHE, Category.CLUSTERING }, headersClass = InfinispanConstants.class) -public class InfinispanRemoteEndpoint extends InfinispanEndpoint implements EndpointLocationAddress { +public class InfinispanRemoteEndpoint extends InfinispanEndpoint implements EndpointServiceLocation { @UriPath(description = "The name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name.") @Metadata(required = true) @@ -59,13 +60,26 @@ public class InfinispanRemoteEndpoint extends InfinispanEndpoint implements Endp } @Override - public String getAddress() { + public String getServiceUrl() { if (configuration.getHosts() != null) { return configuration.getHosts(); } return null; } + @Override + public String getServiceProtocol() { + return "infinispan"; + } + + @Override + public Map<String, String> getServiceMetadata() { + if (configuration.getUsername() != null) { + return Map.of("username", configuration.getUsername()); + } + return null; + } + @Override protected void doStart() throws Exception { super.doStart(); diff --git a/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java b/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java index b5f774bc60c..287c7c79354 100644 --- a/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java +++ b/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java @@ -24,7 +24,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.ScheduledPollEndpoint; @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory; */ @UriEndpoint(firstVersion = "2.17.0", scheme = "ironmq", syntax = "ironmq:queueName", title = "IronMQ", category = { Category.CLOUD, Category.MESSAGING }, headersClass = IronMQConstants.class) -public class IronMQEndpoint extends ScheduledPollEndpoint implements EndpointLocationAddress { +public class IronMQEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(IronMQEndpoint.class); @@ -77,10 +77,15 @@ public class IronMQEndpoint extends ScheduledPollEndpoint implements EndpointLoc } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getIronMQCloud(); } + @Override + public String getServiceProtocol() { + return "ironmq"; + } + public Client getClient() { if (client == null) { client = createClient(); diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java index dd591d94470..f30b6054b9b 100644 --- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java +++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java @@ -28,7 +28,7 @@ import org.apache.camel.Producer; import org.apache.camel.component.kafka.consumer.KafkaManualCommit; import org.apache.camel.component.kafka.consumer.KafkaManualCommitFactory; import org.apache.camel.spi.ClassResolver; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory; */ @UriEndpoint(firstVersion = "2.13.0", scheme = "kafka", title = "Kafka", syntax = "kafka:topic", category = { Category.MESSAGING }, headersClass = KafkaConstants.class) -public class KafkaEndpoint extends DefaultEndpoint implements MultipleConsumersSupport, EndpointLocationAddress { +public class KafkaEndpoint extends DefaultEndpoint implements MultipleConsumersSupport, EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(KafkaEndpoint.class); @@ -74,12 +74,17 @@ public class KafkaEndpoint extends DefaultEndpoint implements MultipleConsumersS } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getBrokers(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "kafka"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (configuration.getClientId() != null) { return Map.of("clientId", configuration.getClientId()); } diff --git a/components/camel-kudu/src/main/java/org/apache/camel/component/kudu/KuduEndpoint.java b/components/camel-kudu/src/main/java/org/apache/camel/component/kudu/KuduEndpoint.java index 1213e3b2837..0e03d38719a 100644 --- a/components/camel-kudu/src/main/java/org/apache/camel/component/kudu/KuduEndpoint.java +++ b/components/camel-kudu/src/main/java/org/apache/camel/component/kudu/KuduEndpoint.java @@ -23,7 +23,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; title = "Kudu", syntax = "kudu:host:port/tableName", category = { Category.DATABASE, Category.IOT, Category.CLOUD }, producerOnly = true, headersClass = KuduConstants.class) -public class KuduEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class KuduEndpoint extends DefaultEndpoint implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(KuduEndpoint.class); private KuduClient kuduClient; @@ -77,10 +77,15 @@ public class KuduEndpoint extends DefaultEndpoint implements EndpointLocationAdd } @Override - public String getAddress() { + public String getServiceUrl() { return host + ":" + port; } + @Override + public String getServiceProtocol() { + return "kudu"; + } + @Override protected void doStart() throws Exception { LOG.trace("Connection: {}, {}", getHost(), getPort()); diff --git a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java index de8212905ec..224746a76eb 100644 --- a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java +++ b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java @@ -21,7 +21,7 @@ import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -31,7 +31,7 @@ import org.apache.camel.support.DefaultEndpoint; */ @UriEndpoint(firstVersion = "2.2.0", scheme = "lucene", title = "Lucene", syntax = "lucene:host:operation", producerOnly = true, category = { Category.DATABASE, Category.SEARCH }, headersClass = LuceneConstants.class) -public class LuceneEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class LuceneEndpoint extends DefaultEndpoint implements EndpointServiceLocation { private LuceneIndexer indexer; private boolean insertFlag; @@ -56,13 +56,18 @@ public class LuceneEndpoint extends DefaultEndpoint implements EndpointLocationA } @Override - public String getAddress() { + public String getServiceUrl() { if (config != null) { return config.getHost(); } return null; } + @Override + public String getServiceProtocol() { + return "lucene"; + } + @Override public Consumer createConsumer(Processor processor) throws Exception { throw new UnsupportedOperationException("Consumer not supported for Lucene endpoint"); diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java index 09a55767a18..22f6762d414 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java @@ -24,7 +24,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.spi.IdempotentRepository; @@ -44,7 +44,7 @@ import static org.apache.camel.component.mail.MailConstants.MAIL_HANDLE_DUPLICAT @UriEndpoint(firstVersion = "1.0.0", scheme = "imap,imaps,pop3,pop3s,smtp,smtps", title = "IMAP,IMAPS,POP3,POP3S,SMTP,SMTPS", syntax = "imap:host:port", alternativeSyntax = "imap:username:password@host:port", category = { Category.MAIL }, headersClass = MailConstants.class) -public class MailEndpoint extends ScheduledPollEndpoint implements HeaderFilterStrategyAware, EndpointLocationAddress { +public class MailEndpoint extends ScheduledPollEndpoint implements HeaderFilterStrategyAware, EndpointServiceLocation { @UriParam(defaultValue = "" + MailConsumer.DEFAULT_CONSUMER_DELAY, javaType = "java.time.Duration", label = "consumer,scheduler", diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java index ab69f2323ae..c9e02812ece 100644 --- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java +++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java @@ -30,7 +30,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.api.management.ManagedAttribute; import org.apache.camel.api.management.ManagedResource; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -51,7 +51,7 @@ import org.slf4j.Logger; @UriEndpoint(scheme = "mllp", firstVersion = "2.17.0", title = "MLLP", syntax = "mllp:hostname:port", category = { Category.HEALTH }, generateConfigurer = true, headersClass = MllpConstants.class) -public class MllpEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class MllpEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriPath @Metadata(required = true) @@ -82,10 +82,15 @@ public class MllpEndpoint extends DefaultEndpoint implements EndpointLocationAdd } @Override - public String getAddress() { + public String getServiceUrl() { return hostname + ":" + port; } + @Override + public String getServiceProtocol() { + return "mllp"; + } + @Override public Exchange createExchange(ExchangePattern exchangePattern) { Exchange mllpExchange = super.createExchange(exchangePattern); diff --git a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsEndpoint.java b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsEndpoint.java index f083f2ad9e1..da047fb4470 100644 --- a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsEndpoint.java +++ b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsEndpoint.java @@ -31,7 +31,7 @@ import org.apache.camel.Consumer; import org.apache.camel.MultipleConsumersSupport; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.spi.UriEndpoint; @@ -45,7 +45,7 @@ import org.apache.camel.util.ObjectHelper; */ @UriEndpoint(firstVersion = "2.17.0", scheme = "nats", title = "Nats", syntax = "nats:topic", category = { Category.MESSAGING }, headersClass = NatsConstants.class) -public class NatsEndpoint extends DefaultEndpoint implements MultipleConsumersSupport, HeaderFilterStrategyAware, EndpointLocationAddress { +public class NatsEndpoint extends DefaultEndpoint implements MultipleConsumersSupport, HeaderFilterStrategyAware, EndpointServiceLocation { @UriParam private NatsConfiguration configuration; @@ -73,10 +73,15 @@ public class NatsEndpoint extends DefaultEndpoint implements MultipleConsumersSu } @Override - public String getAddress() { + public String getServiceUrl() { return getConfiguration().getServers(); } + @Override + public String getServiceProtocol() { + return "nats"; + } + public ExecutorService createExecutor() { return getCamelContext().getExecutorServiceManager().newFixedThreadPool(this, "NatsTopic[" + configuration.getTopic() + "]", configuration.getPoolSize()); diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java index c9b978fb46e..0ec9f4e1962 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java @@ -32,7 +32,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -44,7 +44,7 @@ import org.apache.camel.util.ObjectHelper; */ @UriEndpoint(firstVersion = "2.14.0", scheme = "netty", title = "Netty", syntax = "netty:protocol://host:port", category = { Category.NETWORKING }, headersClass = NettyConstants.class) -public class NettyEndpoint extends DefaultEndpoint implements AsyncEndpoint, EndpointLocationAddress { +public class NettyEndpoint extends DefaultEndpoint implements AsyncEndpoint, EndpointServiceLocation { @UriParam private NettyConfiguration configuration; @UriParam(defaultValue = "false", label = "advanced", @@ -57,10 +57,15 @@ public class NettyEndpoint extends DefaultEndpoint implements AsyncEndpoint, End } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getProtocol() + ":" + configuration.getHost() + ":" + configuration.getPort(); } + @Override + public String getServiceProtocol() { + return configuration.getProtocol(); + } + public boolean isSynchronous() { return synchronous; } diff --git a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java index 7770e0106b6..f1fbc1d2012 100644 --- a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java +++ b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -32,7 +32,7 @@ import org.opensearch.client.RestClient; @UriEndpoint(firstVersion = "4.0.0", scheme = "opensearch", title = "OpenSearch", syntax = "opensearch:clusterName", producerOnly = true, category = { Category.SEARCH, Category.MONITORING }, headersClass = OpensearchConstants.class) -public class OpensearchEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class OpensearchEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriParam private final OpensearchConfiguration configuration; @@ -65,7 +65,12 @@ public class OpensearchEndpoint extends DefaultEndpoint implements EndpointLocat } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getHostAddresses(); } + + @Override + public String getServiceProtocol() { + return "opensearch"; + } } diff --git a/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java b/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java index 37c0724d9a0..de690231832 100644 --- a/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java +++ b/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java @@ -24,7 +24,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -44,7 +44,7 @@ import org.eclipse.paho.mqttv5.common.MqttMessage; @UriEndpoint(firstVersion = "3.8.0", scheme = "paho-mqtt5", title = "Paho MQTT 5", category = { Category.MESSAGING, Category.IOT }, syntax = "paho-mqtt5:topic", headersClass = PahoMqtt5Constants.class) -public class PahoMqtt5Endpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class PahoMqtt5Endpoint extends DefaultEndpoint implements EndpointServiceLocation { // Configuration members @UriPath(description = "Name of the topic") @@ -77,12 +77,17 @@ public class PahoMqtt5Endpoint extends DefaultEndpoint implements EndpointLocati } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getBrokerUrl(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "mqtt"; + } + + @Override + public Map<String, String> getServiceMetadata() { Map<String, String> map = new HashMap<>(); if (configuration.getClientId() != null) { map.put("clientId", configuration.getClientId()); diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java index fa319d5840b..c115f7356f1 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -41,7 +41,7 @@ import java.util.Map; */ @UriEndpoint(firstVersion = "2.16.0", scheme = "paho", title = "Paho", category = { Category.MESSAGING, Category.IOT }, syntax = "paho:topic", headersClass = PahoConstants.class) -public class PahoEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class PahoEndpoint extends DefaultEndpoint implements EndpointServiceLocation { // Configuration members @UriPath(description = "Name of the topic") @@ -74,12 +74,17 @@ public class PahoEndpoint extends DefaultEndpoint implements EndpointLocationAdd } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getBrokerUrl(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "mqtt"; + } + + @Override + public Map<String, String> getServiceMetadata() { Map<String, String> map = new HashMap<>(); if (configuration.getClientId() != null) { map.put("clientId", configuration.getClientId()); diff --git a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java index e5bc1be80e5..8bfe1f86bd5 100644 --- a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java +++ b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java @@ -25,7 +25,7 @@ import org.apache.camel.component.platform.http.cookie.CookieConfiguration; import org.apache.camel.component.platform.http.spi.PlatformHttpConsumer; import org.apache.camel.component.platform.http.spi.PlatformHttpEngine; import org.apache.camel.http.base.HttpHeaderFilterStrategy; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.spi.Metadata; @@ -43,7 +43,7 @@ import org.apache.camel.support.DefaultEndpoint; "protocol=http", }) public class PlatformHttpEndpoint extends DefaultEndpoint - implements AsyncEndpoint, HeaderFilterStrategyAware, EndpointLocationAddress { + implements AsyncEndpoint, HeaderFilterStrategyAware, EndpointServiceLocation { private static final String PROXY_PATH = "proxy"; @@ -98,7 +98,7 @@ public class PlatformHttpEndpoint extends DefaultEndpoint } @Override - public String getAddress() { + public String getServiceUrl() { String server = "http://0.0.0.0"; int port = getOrCreateEngine().getServerPort(); if (port > 0) { diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java index 36633ac902d..fd6de025b5b 100644 --- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java +++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java @@ -21,7 +21,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.pulsar.utils.message.PulsarMessageHeaders; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -37,7 +37,7 @@ import org.apache.pulsar.client.api.PulsarClient; @UriEndpoint(scheme = "pulsar", firstVersion = "2.24.0", title = "Pulsar", syntax = "pulsar:persistence://tenant/namespace/topic", category = { Category.MESSAGING }, headersClass = PulsarMessageHeaders.class) -public class PulsarEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class PulsarEndpoint extends DefaultEndpoint implements EndpointServiceLocation { private PulsarClient pulsarClient; @@ -62,10 +62,15 @@ public class PulsarEndpoint extends DefaultEndpoint implements EndpointLocationA } @Override - public String getAddress() { + public String getServiceUrl() { return pulsarConfiguration.getServiceUrl(); } + @Override + public String getServiceProtocol() { + return "pulsar"; + } + @Override public Producer createProducer() { return new PulsarProducer(this); diff --git a/components/camel-rocketmq/src/main/java/org/apache/camel/component/rocketmq/RocketMQEndpoint.java b/components/camel-rocketmq/src/main/java/org/apache/camel/component/rocketmq/RocketMQEndpoint.java index dd76eba6062..575645e1f0e 100644 --- a/components/camel-rocketmq/src/main/java/org/apache/camel/component/rocketmq/RocketMQEndpoint.java +++ b/components/camel-rocketmq/src/main/java/org/apache/camel/component/rocketmq/RocketMQEndpoint.java @@ -23,7 +23,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,7 +36,7 @@ import org.apache.camel.support.DefaultMessage; */ @UriEndpoint(firstVersion = "3.20.0", scheme = "rocketmq", syntax = "rocketmq:topicName", title = "RocketMQ", category = Category.MESSAGING, headersClass = RocketMQConstants.class) -public class RocketMQEndpoint extends DefaultEndpoint implements AsyncEndpoint, EndpointLocationAddress { +public class RocketMQEndpoint extends DefaultEndpoint implements AsyncEndpoint, EndpointServiceLocation { @UriPath @Metadata(required = true) @@ -74,10 +74,15 @@ public class RocketMQEndpoint extends DefaultEndpoint implements AsyncEndpoint, } @Override - public String getAddress() { + public String getServiceUrl() { return namesrvAddr; } + @Override + public String getServiceProtocol() { + return "rocketmq"; + } + @Override public Producer createProducer() { return new RocketMQProducer(this); diff --git a/components/camel-sap-netweaver/src/main/java/org/apache/camel/component/sap/netweaver/NetWeaverEndpoint.java b/components/camel-sap-netweaver/src/main/java/org/apache/camel/component/sap/netweaver/NetWeaverEndpoint.java index 1b2e745bc13..6670413464e 100644 --- a/components/camel-sap-netweaver/src/main/java/org/apache/camel/component/sap/netweaver/NetWeaverEndpoint.java +++ b/components/camel-sap-netweaver/src/main/java/org/apache/camel/component/sap/netweaver/NetWeaverEndpoint.java @@ -21,7 +21,7 @@ import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,7 +36,7 @@ import java.util.Map; @UriEndpoint(firstVersion = "2.12.0", scheme = "sap-netweaver", title = "SAP NetWeaver", syntax = "sap-netweaver:url", producerOnly = true, category = { Category.SAAS }, headersClass = NetWeaverConstants.class) -public class NetWeaverEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class NetWeaverEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriPath @Metadata(required = true) diff --git a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java index 93b938cea3d..7d88cd3fa4c 100644 --- a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java +++ b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,7 +35,7 @@ import java.util.Map; @UriEndpoint(firstVersion = "4.3.0", scheme = "smb", title = "SMB", syntax = "smb:hostname:port/shareName", consumerOnly = true, category = { Category.FILE }) -public class SmbEndpoint extends ScheduledPollEndpoint implements EndpointLocationAddress { +public class SmbEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { @UriPath @Metadata(required = true) @@ -57,7 +57,7 @@ public class SmbEndpoint extends ScheduledPollEndpoint implements EndpointLocati } @Override - public String getAddress() { + public String getServiceUrl() { if (port != 0) { return hostname + ":" + port; } else { @@ -66,7 +66,12 @@ public class SmbEndpoint extends ScheduledPollEndpoint implements EndpointLocati } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "smb"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (configuration.getUsername() != null) { return Map.of("username", configuration.getUsername()); } diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java index 98e9eb47e56..62dc5fcfeb6 100644 --- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java +++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java @@ -23,7 +23,7 @@ import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -35,7 +35,7 @@ import org.jsmpp.bean.DeliverSm; */ @UriEndpoint(firstVersion = "2.2.0", scheme = "smpp,smpps", title = "SMPP", syntax = "smpp:host:port", category = { Category.MOBILE }, lenientProperties = true, headersClass = SmppConstants.class) -public class SmppEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class SmppEndpoint extends DefaultEndpoint implements EndpointServiceLocation { private SmppBinding binding; @UriParam @@ -47,10 +47,15 @@ public class SmppEndpoint extends DefaultEndpoint implements EndpointLocationAdd } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getHost() + ":" + configuration.getPort(); } + @Override + public String getServiceProtocol() { + return "smpp"; + } + @Override protected String createEndpointUri() { return getConnectionString(); diff --git a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java index 9fccaebe9ca..60c6ba53eaa 100644 --- a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java +++ b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpEndpoint.java @@ -23,7 +23,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -40,7 +40,7 @@ import org.snmp4j.security.SecurityLevel; */ @UriEndpoint(firstVersion = "2.1.0", scheme = "snmp", title = "SNMP", syntax = "snmp:host:port", category = { Category.MONITORING }) -public class SnmpEndpoint extends DefaultPollingEndpoint implements EndpointLocationAddress { +public class SnmpEndpoint extends DefaultPollingEndpoint implements EndpointServiceLocation { public static final String DEFAULT_COMMUNITY = "public"; public static final int DEFAULT_SNMP_VERSION = SnmpConstants.version1; @@ -105,7 +105,7 @@ public class SnmpEndpoint extends DefaultPollingEndpoint implements EndpointLoca } @Override - public String getAddress() { + public String getServiceUrl() { if (port != null) { return host + ":" + port; } else { @@ -113,6 +113,11 @@ public class SnmpEndpoint extends DefaultPollingEndpoint implements EndpointLoca } } + @Override + public String getServiceProtocol() { + return "snmp"; + } + @Override public Consumer createConsumer(Processor processor) throws Exception { if (this.type == SnmpActionType.TRAP) { diff --git a/components/camel-splunk-hec/src/main/java/org/apache/camel/component/splunkhec/SplunkHECEndpoint.java b/components/camel-splunk-hec/src/main/java/org/apache/camel/component/splunkhec/SplunkHECEndpoint.java index 687a7f6f070..b7223d04bc3 100644 --- a/components/camel-splunk-hec/src/main/java/org/apache/camel/component/splunkhec/SplunkHECEndpoint.java +++ b/components/camel-splunk-hec/src/main/java/org/apache/camel/component/splunkhec/SplunkHECEndpoint.java @@ -23,7 +23,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -38,7 +38,7 @@ import org.apache.commons.validator.routines.InetAddressValidator; @UriEndpoint(firstVersion = "3.3.0", scheme = "splunk-hec", title = "Splunk HEC", producerOnly = true, syntax = "splunk-hec:splunkURL", category = { Category.MONITORING }, headersClass = SplunkHECConstants.class) -public class SplunkHECEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class SplunkHECEndpoint extends DefaultEndpoint implements EndpointServiceLocation { private static final Pattern SPLUNK_URL_PATTERN = Pattern.compile("^(.*?):(\\d+)$"); private static final Pattern SPLUNK_TOKEN_PATTERN = Pattern.compile("^\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"); @@ -100,10 +100,15 @@ public class SplunkHECEndpoint extends DefaultEndpoint implements EndpointLocati } @Override - public String getAddress() { + public String getServiceUrl() { return splunkURL; } + @Override + public String getServiceProtocol() { + return "splunk"; + } + public SplunkHECConfiguration getConfiguration() { return configuration; } diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java index 77873346954..ec90916e8b1 100644 --- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java +++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkEndpoint.java @@ -28,7 +28,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.ScheduledPollEndpoint; @@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory; */ @UriEndpoint(firstVersion = "2.13.0", scheme = "splunk", title = "Splunk", syntax = "splunk:name", category = { Category.IOT, Category.MONITORING }) -public class SplunkEndpoint extends ScheduledPollEndpoint implements EndpointLocationAddress { +public class SplunkEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(SplunkEndpoint.class); @@ -60,12 +60,17 @@ public class SplunkEndpoint extends ScheduledPollEndpoint implements EndpointLoc } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getHost() + ":" + configuration.getPort(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "splunk"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (configuration.getUsername() != null) { return Map.of("username", configuration.getUsername()); } diff --git a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java index f9a1dfd5814..1665537a892 100644 --- a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java +++ b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java @@ -26,7 +26,7 @@ import org.apache.camel.Exchange; import org.apache.camel.PollingConsumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -57,7 +57,7 @@ import static org.apache.camel.component.springrabbit.SpringRabbitMQConstants.DI @UriEndpoint(firstVersion = "3.8.0", scheme = "spring-rabbitmq", title = "Spring RabbitMQ", syntax = "spring-rabbitmq:exchangeName", category = { Category.MESSAGING }, headersClass = SpringRabbitMQConstants.class) -public class SpringRabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint, EndpointLocationAddress { +public class SpringRabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint, EndpointServiceLocation { public static final String ARG_PREFIX = "arg."; public static final String CONSUMER_ARG_PREFIX = "consumer."; @@ -213,7 +213,7 @@ public class SpringRabbitMQEndpoint extends DefaultEndpoint implements AsyncEndp } @Override - public String getAddress() { + public String getServiceUrl() { int port = 0; String host = null; if (getConnectionFactory() != null) { @@ -227,7 +227,12 @@ public class SpringRabbitMQEndpoint extends DefaultEndpoint implements AsyncEndp } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "amqp"; + } + + @Override + public Map<String, String> getServiceMetadata() { String un = null; if (getConnectionFactory() != null) { un = getConnectionFactory().getUsername(); diff --git a/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/RedisEndpoint.java b/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/RedisEndpoint.java index e74dc010458..fdc4049b430 100644 --- a/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/RedisEndpoint.java +++ b/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/RedisEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -31,7 +31,7 @@ import org.springframework.data.redis.core.RedisTemplate; */ @UriEndpoint(firstVersion = "2.11.0", scheme = "spring-redis", title = "Spring Redis", syntax = "spring-redist:host:port", category = { Category.CACHE }, headersClass = RedisConstants.class) -public class RedisEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class RedisEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriParam private final RedisConfiguration configuration; @@ -62,10 +62,15 @@ public class RedisEndpoint extends DefaultEndpoint implements EndpointLocationAd } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getHost() + ":" + configuration.getPort(); } + @Override + public String getServiceProtocol() { + return "redis"; + } + @Override protected void doShutdown() throws Exception { super.doShutdown(); diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java index eacae6f97ef..31c5ae5f60f 100644 --- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java +++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java @@ -27,7 +27,7 @@ import java.util.Map; import javax.sql.DataSource; import org.apache.camel.Component; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultPollingEndpoint; @@ -39,7 +39,7 @@ import org.springframework.jdbc.datasource.AbstractDriverBasedDataSource; /** * Base class for SQL endpoints. */ -public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint implements EndpointLocationAddress { +public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint implements EndpointServiceLocation { private JdbcTemplate jdbcTemplate; @Metadata(autowired = true) @@ -139,7 +139,7 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint implemen } @Override - public String getAddress() { + public String getServiceUrl() { if (dataSource != null && dataSource instanceof AbstractDriverBasedDataSource ads) { return ads.getUrl(); } @@ -147,7 +147,12 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint implemen } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "jdbc"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (dataSource != null && dataSource instanceof AbstractDriverBasedDataSource ads) { String u = ads.getUsername(); if (u != null) { diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java index 4a7ded2899a..d5a319878a2 100644 --- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java +++ b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java @@ -20,7 +20,7 @@ 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.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.ScheduledPollEndpoint; @@ -34,7 +34,7 @@ import java.util.Map; @UriEndpoint(firstVersion = "2.10.0", scheme = "ssh", title = "SSH", syntax = "ssh:host:port", alternativeSyntax = "ssh:username:password@host:port", category = { Category.FILE }, headersClass = SshConstants.class) -public class SshEndpoint extends ScheduledPollEndpoint implements EndpointLocationAddress { +public class SshEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { @UriParam private SshConfiguration configuration; @@ -71,12 +71,17 @@ public class SshEndpoint extends ScheduledPollEndpoint implements EndpointLocati } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getHost() + ":" + configuration.getPort(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "ssh"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (configuration.getUsername() != null) { return Map.of("username", configuration.getUsername()); } diff --git a/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java b/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java index b4ba1ed90a2..b0be2988d2f 100644 --- a/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java +++ b/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java @@ -30,7 +30,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.spi.Metadata; @@ -60,7 +60,7 @@ import static org.fusesource.stomp.client.Constants.UNSUBSCRIBE; */ @UriEndpoint(firstVersion = "2.12.0", scheme = "stomp", title = "Stomp", syntax = "stomp:destination", category = { Category.MESSAGING }) -public class StompEndpoint extends DefaultEndpoint implements AsyncEndpoint, HeaderFilterStrategyAware, EndpointLocationAddress { +public class StompEndpoint extends DefaultEndpoint implements AsyncEndpoint, HeaderFilterStrategyAware, EndpointServiceLocation { private CallbackConnection connection; private Stomp stomp; @@ -98,12 +98,17 @@ public class StompEndpoint extends DefaultEndpoint implements AsyncEndpoint, Hea } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getBrokerURL(); } @Override - public Map<String, String> getAddressMetadata() { + public String getServiceProtocol() { + return "stomp"; + } + + @Override + public Map<String, String> getServiceMetadata() { if (configuration.getLogin() != null) { return Map.of("username", configuration.getLogin()); } diff --git a/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/AbstractSpanDecorator.java b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/AbstractSpanDecorator.java index a249423ecff..42742c611e4 100644 --- a/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/AbstractSpanDecorator.java +++ b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/AbstractSpanDecorator.java @@ -20,7 +20,7 @@ import java.util.*; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.tracing.ExtractAdapter; import org.apache.camel.tracing.InjectAdapter; import org.apache.camel.tracing.SpanAdapter; @@ -109,12 +109,12 @@ public abstract class AbstractSpanDecorator implements SpanDecorator { span.setTag(TagConstants.URL_QUERY, query); } - if (endpoint instanceof EndpointLocationAddress ela) { - String adr = ela.getAddress(); + if (endpoint instanceof EndpointServiceLocation ela) { + String adr = ela.getServiceUrl(); if (adr != null) { span.setTag(TagConstants.SERVER_ADDRESS, adr); } - Map map = ela.getAddressMetadata(); + Map map = ela.getServiceMetadata(); if (map != null) { String un = (String) map.get("username"); if (un != null) { diff --git a/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpEndpoint.java b/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpEndpoint.java index 1ed948abe97..d29390a342c 100644 --- a/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpEndpoint.java +++ b/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpEndpoint.java @@ -28,7 +28,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.vertx.common.VertxHelper; import org.apache.camel.http.base.HttpHelper; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -39,7 +39,7 @@ import org.apache.camel.util.ObjectHelper; @UriEndpoint(firstVersion = "3.5.0", scheme = "vertx-http", title = "Vert.x HTTP Client", syntax = "vertx-http:httpUri", category = { Category.HTTP }, producerOnly = true, lenientProperties = true, headersClass = VertxHttpConstants.class) -public class VertxHttpEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class VertxHttpEndpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriParam private final VertxHttpConfiguration configuration; @@ -54,13 +54,18 @@ public class VertxHttpEndpoint extends DefaultEndpoint implements EndpointLocati } @Override - public String getAddress() { + public String getServiceUrl() { if (configuration != null && configuration.getHttpUri() != null) { return configuration.getHttpUri().toString(); } return null; } + @Override + public String getServiceProtocol() { + return "http"; + } + @Override public VertxHttpComponent getComponent() { return (VertxHttpComponent) super.getComponent(); diff --git a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java index 41c8fcff47e..28c6cadce0c 100644 --- a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java +++ b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java @@ -35,7 +35,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.vertx.common.VertxHelper; -import org.apache.camel.spi.EndpointLocationAddress; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -52,7 +52,7 @@ import static org.apache.camel.component.vertx.websocket.VertxWebsocketConstants @UriEndpoint(firstVersion = "3.5.0", scheme = "vertx-websocket", title = "Vert.x WebSocket", syntax = "vertx-websocket:host:port/path", category = { Category.HTTP, Category.NETWORKING }, headersClass = VertxWebsocketConstants.class, lenientProperties = true) -public class VertxWebsocketEndpoint extends DefaultEndpoint implements EndpointLocationAddress { +public class VertxWebsocketEndpoint extends DefaultEndpoint implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(VertxWebsocketEndpoint.class); @@ -68,10 +68,15 @@ public class VertxWebsocketEndpoint extends DefaultEndpoint implements EndpointL } @Override - public String getAddress() { + public String getServiceUrl() { return configuration.getHost() + ":" + configuration.getPort(); } + @Override + public String getServiceProtocol() { + return "websocket"; + } + @Override public boolean isLenientProperties() { // Enable custom query parameters to be passed on the producer WebSocket URI