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 2025/07/22 13:48:28 UTC
(camel) 01/02: CAMEL-17339 - Avoid List as configuration parameter types in Endpoint configurations - Camel Consul Tags
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch CAMEL-17339-continue
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1a93a0cdaefa425b572047b53c1737b1cfa14ba7
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Jul 22 15:45:58 2025 +0200
CAMEL-17339 - Avoid List<String> as configuration parameter types in Endpoint configurations - Camel Consul Tags
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../component/consul/ConsulClientConfiguration.java | 20 ++++++++++----------
.../consul/cloud/ConsulServiceDiscovery.java | 2 +-
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulClientConfiguration.java b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulClientConfiguration.java
index eea53843f48..6c7bb57fa6d 100644
--- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulClientConfiguration.java
+++ b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulClientConfiguration.java
@@ -44,7 +44,7 @@ public abstract class ConsulClientConfiguration implements Cloneable {
@UriParam(label = "advanced", defaultValue = "DEFAULT", enums = "DEFAULT,STALE,CONSISTENT")
private ConsistencyMode consistencyMode = ConsistencyMode.DEFAULT;
@UriParam(javaType = "java.lang.String")
- private Set<String> tags;
+ private String tags;
@UriParam(label = "security")
private SSLContextParameters sslContextParameters;
@@ -155,23 +155,23 @@ public abstract class ConsulClientConfiguration implements Cloneable {
this.consistencyMode = consistencyMode;
}
- public Set<String> getTags() {
+ public String getTags() {
return tags;
}
- /**
- * Set tags. You can separate multiple tags by comma.
- */
- public void setTags(Set<String> tags) {
- this.tags = tags;
+ public Collection<String> getTagAsSet() {
+ if (tags != null) {
+ return Set.of(tags.split(","));
+ } else {
+ return null;
+ }
}
/**
* Set tags. You can separate multiple tags by comma.
*/
- public void setTags(String tagsAsString) {
- this.tags = new HashSet<>();
- Collections.addAll(tags, tagsAsString.split(","));
+ public void setTags(String tags) {
+ this.tags = tags;
}
public SSLContextParameters getSslContextParameters() {
diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
index 6cc5e57d8ed..1201de60176 100644
--- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
+++ b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
@@ -53,7 +53,7 @@ public final class ConsulServiceDiscovery extends DefaultServiceDiscovery {
ImmutableQueryOptions.Builder builder = ImmutableQueryOptions.builder();
ObjectHelper.ifNotEmpty(configuration.getDatacenter(), builder::datacenter);
- ObjectHelper.ifNotEmpty(configuration.getTags(), builder::tag);
+ ObjectHelper.ifNotEmpty(configuration.getTagAsSet(), builder::tag);
queryOptions = builder.build();
}