You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/05/23 08:05:13 UTC
[26/34] camel git commit: CAMEL-9683: Separate configuration of k8s
and ribbon to have their own model.
CAMEL-9683: Separate configuration of k8s and ribbon to have their own model.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ba718657
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ba718657
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ba718657
Branch: refs/heads/remoteServiceCall
Commit: ba718657cceafd6c9aa2b5fa2a84faf9c12232f1
Parents: ff68851
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 17 16:34:06 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon May 23 09:27:40 2016 +0200
----------------------------------------------------------------------
.../model/remote/ServiceCallDefinition.java | 26 +++-----------------
.../processor/KubernetesProcessorFactory.java | 7 ++----
.../processor/RibbonProcessorFactory.java | 8 +-----
.../processor/RibbonServiceCallProcessor.java | 8 +++---
4 files changed, 10 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ba718657/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java b/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java
index c5b668c..f12ce74 100644
--- a/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java
@@ -40,16 +40,14 @@ import org.apache.camel.util.CamelContextHelper;
@XmlAccessorType(XmlAccessType.FIELD)
public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinition> {
- @XmlElement
- private ServiceCallConfigurationDefinition serviceCallConfiguration;
+ @XmlAttribute @Metadata(required = "true")
+ private String name;
@XmlAttribute @Metadata(required = "true")
private String uri;
@XmlAttribute
private ExchangePattern pattern;
- @XmlAttribute @Metadata(defaultValue = "default")
- private String namespace;
- @XmlAttribute @Metadata(required = "true")
- private String name;
+ @XmlElement
+ private ServiceCallConfigurationDefinition serviceCallConfiguration;
@XmlAttribute
private String serviceCallConfigurationRef;
@XmlAttribute
@@ -102,14 +100,6 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit
}
/**
- * Sets the namespace of the service to use
- */
- public ServiceCallDefinition namespace(String namespace) {
- setNamespace(namespace);
- return this;
- }
-
- /**
* Sets the name of the service to use
*/
public ServiceCallDefinition name(String name) {
@@ -204,14 +194,6 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit
this.name = name;
}
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
public ExchangePattern getPattern() {
return pattern;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ba718657/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
index 7378d69..a33e54e 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
@@ -51,7 +51,6 @@ public class KubernetesProcessorFactory implements ProcessorFactory {
ServiceCallDefinition sc = (ServiceCallDefinition) definition;
String name = sc.getName();
- String namespace = sc.getNamespace();
String uri = sc.getUri();
ExchangePattern mep = sc.getPattern();
@@ -95,10 +94,8 @@ public class KubernetesProcessorFactory implements ProcessorFactory {
KubernetesConfiguration kc = new KubernetesConfiguration();
IntrospectionSupport.setProperties(kc, parameters);
- // use namespace from config if not provided
- if (namespace == null) {
- namespace = kc.getNamespace();
- }
+ // use namespace from config
+ String namespace = kc.getNamespace();
// lookup the load balancer to use (configured on EIP takes precedence vs configured on configuration)
ServiceCallLoadBalancer lb = configureLoadBalancer(routeContext, sc);
http://git-wip-us.apache.org/repos/asf/camel/blob/ba718657/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
index e3ab4d9..3448527 100644
--- a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
+++ b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
@@ -52,7 +52,6 @@ public class RibbonProcessorFactory implements ProcessorFactory {
ServiceCallDefinition sc = (ServiceCallDefinition) definition;
String name = sc.getName();
- String namespace = sc.getNamespace();
String uri = sc.getUri();
ExchangePattern mep = sc.getPattern();
@@ -97,11 +96,6 @@ public class RibbonProcessorFactory implements ProcessorFactory {
RibbonConfiguration rc = new RibbonConfiguration();
IntrospectionSupport.setProperties(rc, parameters);
- // use namespace from config if not provided
- if (namespace == null) {
- namespace = rc.getNamespace();
- }
-
// lookup the load balancer to use (configured on EIP takes precedence vs configured on configuration)
Object lb = configureLoadBalancer(routeContext, sc);
if (lb == null && config != null) {
@@ -127,7 +121,7 @@ public class RibbonProcessorFactory implements ProcessorFactory {
Map<String, String> properties = configureProperties(routeContext, config, configRef);
- RibbonServiceCallProcessor processor = new RibbonServiceCallProcessor(name, namespace, uri, mep, rc);
+ RibbonServiceCallProcessor processor = new RibbonServiceCallProcessor(name, uri, mep, rc);
processor.setRule((IRule) lb);
processor.setServerListStrategy(sl);
processor.setRibbonClientConfig(properties);
http://git-wip-us.apache.org/repos/asf/camel/blob/ba718657/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallProcessor.java b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallProcessor.java
index 3b83d19..530fd40 100644
--- a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallProcessor.java
+++ b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallProcessor.java
@@ -61,7 +61,6 @@ public class RibbonServiceCallProcessor extends ServiceSupport implements AsyncP
private final String name;
private final String scheme;
private final String contextPath;
- private final String namespace;
private final String uri;
private final ExchangePattern exchangePattern;
private final RibbonConfiguration configuration;
@@ -73,7 +72,7 @@ public class RibbonServiceCallProcessor extends ServiceSupport implements AsyncP
private Map<String, String> ribbonClientConfig;
private SendDynamicProcessor processor;
- public RibbonServiceCallProcessor(String name, String namespace, String uri, ExchangePattern exchangePattern, RibbonConfiguration configuration) {
+ public RibbonServiceCallProcessor(String name, String uri, ExchangePattern exchangePattern, RibbonConfiguration configuration) {
// setup from the provided name which can contain scheme and context-path information as well
String serviceName;
if (name.contains("/")) {
@@ -94,7 +93,6 @@ public class RibbonServiceCallProcessor extends ServiceSupport implements AsyncP
this.name = serviceName;
}
- this.namespace = namespace;
this.uri = uri;
this.exchangePattern = exchangePattern;
this.configuration = configuration;
@@ -115,7 +113,7 @@ public class RibbonServiceCallProcessor extends ServiceSupport implements AsyncP
// let the client load balancer chose which server to use
server = ribbonLoadBalancer.chooseServer();
if (server == null) {
- exchange.setException(new RejectedExecutionException("No active services with name " + name + " in namespace " + namespace));
+ exchange.setException(new RejectedExecutionException("No active services with name " + name));
}
} catch (Throwable e) {
exchange.setException(e);
@@ -231,7 +229,7 @@ public class RibbonServiceCallProcessor extends ServiceSupport implements AsyncP
ServerListUpdater updater = new PollingServerListUpdater(config);
ribbonLoadBalancer = new ZoneAwareLoadBalancer<>(config, rule, ping, (ServerList<RibbonServer>) serverListStrategy, null, updater);
- LOG.info("RibbonServiceCall at namespace: {} with service name: {} is using load balancer: {} and server list: {}", namespace, name, ribbonLoadBalancer, serverListStrategy);
+ LOG.info("RibbonServiceCall with service name: {} is using load balancer: {} and server list: {}", name, ribbonLoadBalancer, serverListStrategy);
processor = new SendDynamicProcessor(uri, serviceCallExpression);
processor.setCamelContext(getCamelContext());