You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/04/03 13:05:58 UTC
camel git commit: CAMEL-11100: service-call : add an option configure
the expression to use (i.e simple)
Repository: camel
Updated Branches:
refs/heads/master fe57a498f -> f01bb49da
CAMEL-11100: service-call : add an option configure the expression to use (i.e simple)
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f01bb49d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f01bb49d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f01bb49d
Branch: refs/heads/master
Commit: f01bb49da4a427b324129891a22422459ff424bf
Parents: fe57a49
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 3 15:04:49 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 3 15:04:49 2017 +0200
----------------------------------------------------------------------
.../cloud/DefaultServiceCallExpression.java | 7 +
.../ServiceCallConfigurationDefinition.java | 16 ---
.../model/cloud/ServiceCallDefinition.java | 16 ---
.../ServiceCallExpressionConfiguration.java | 112 +++++++++++-----
.../cloud/ServiceCallConfigurationTest.java | 46 +++++++
...ingConsulExpressionServiceCallRouteTest.java | 28 ++++
...ringConsulExpressionServiceCallRouteTest.xml | 127 +++++++++++++++++++
.../CamelCloudConfigurationProperties.java | 15 ++-
...rviceCallConfigurationAutoConfiguration.java | 17 ++-
.../CamelCloudServiceCallExpressionTest.java | 90 -------------
.../CamelCloudServiceCallRefExpressionTest.java | 99 +++++++++++++++
...melCloudServiceCallSimpleExpressionTest.java | 91 +++++++++++++
.../cloud/ServiceCallConfigurationTest.java | 53 +++++---
.../cloud/ServiceCallConfigurationTest.xml | 4 +
14 files changed, 549 insertions(+), 172 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
index e1c49f7..f16e59b 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
@@ -36,6 +36,13 @@ import org.slf4j.LoggerFactory;
public class DefaultServiceCallExpression extends ServiceCallExpressionSupport {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultServiceCallExpression.class);
+ public DefaultServiceCallExpression() {
+ }
+
+ public DefaultServiceCallExpression(String hostHeader, String portHeader) {
+ super(hostHeader, portHeader);
+ }
+
@Override
protected String buildCamelEndpointUri(String name, String host, Integer port, String uri, String contextPath, String scheme) {
// build basic uri if none provided
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
index aa0be7d..2d09680 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
@@ -31,7 +31,6 @@ import org.apache.camel.cloud.ServiceChooser;
import org.apache.camel.cloud.ServiceDiscovery;
import org.apache.camel.cloud.ServiceFilter;
import org.apache.camel.model.IdentifiedType;
-import org.apache.camel.model.language.SimpleExpression;
import org.apache.camel.spi.Metadata;
/**
@@ -246,13 +245,6 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType {
this.expression = expression;
}
- /**
- * Set a custom {@link Expression} using the {@link org.apache.camel.language.simple.SimpleLanguage}
- */
- public void setSimpleExpression(String expression) {
- setExpression(new SimpleExpression(expression));
- }
-
public ServiceCallServiceDiscoveryConfiguration getServiceDiscoveryConfiguration() {
return serviceDiscoveryConfiguration;
}
@@ -413,14 +405,6 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType {
}
/**
- * Set a custom {@link Expression} using the {@link org.apache.camel.language.simple.SimpleLanguage}
- */
- public ServiceCallConfigurationDefinition simpleExpression(String expression) {
- setExpression(new SimpleExpression(expression));
- return this;
- }
-
- /**
* Configures the ServiceDiscovery using the given configuration.
*/
public ServiceCallConfigurationDefinition serviceDiscoveryConfiguration(ServiceCallServiceDiscoveryConfiguration serviceDiscoveryConfiguration) {
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
index 4b3ac75..f0bf660 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
@@ -46,7 +46,6 @@ import org.apache.camel.impl.cloud.PassThroughServiceFilter;
import org.apache.camel.impl.cloud.RandomServiceChooser;
import org.apache.camel.impl.cloud.RoundRobinServiceChooser;
import org.apache.camel.model.NoOutputDefinition;
-import org.apache.camel.model.language.SimpleExpression;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.util.ObjectHelper;
@@ -307,13 +306,6 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit
this.expression = expression;
}
- /**
- * Set a custom {@link Expression} using the {@link org.apache.camel.language.simple.SimpleLanguage}
- */
- public void setSimpleExpression(String expression) {
- setExpression(new SimpleExpression(expression));
- }
-
public ServiceCallServiceDiscoveryConfiguration getServiceDiscoveryConfiguration() {
return serviceDiscoveryConfiguration;
}
@@ -483,14 +475,6 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit
}
/**
- * Set a custom {@link Expression} using the {@link org.apache.camel.language.simple.SimpleLanguage}
- */
- public ServiceCallDefinition simpleExpression(String expression) {
- setExpression(new SimpleExpression(expression));
- return this;
- }
-
- /**
* Configures the ServiceDiscovery using the given configuration.
*/
public ServiceCallDefinition serviceDiscoveryConfiguration(ServiceCallServiceDiscoveryConfiguration serviceDiscoveryConfiguration) {
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
index 873c9e3..2c1838f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
@@ -33,10 +34,12 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Expression;
import org.apache.camel.NoFactoryAvailableException;
import org.apache.camel.cloud.ServiceExpressionFactory;
+import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
import org.apache.camel.impl.cloud.ServiceCallConstants;
import org.apache.camel.model.IdentifiedType;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.PropertyDefinition;
+import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.spi.Metadata;
import org.apache.camel.util.CamelContextHelper;
import org.apache.camel.util.IntrospectionSupport;
@@ -58,6 +61,10 @@ public class ServiceCallExpressionConfiguration extends IdentifiedType implement
private String hostHeader = ServiceCallConstants.SERVICE_HOST;
@XmlAttribute @Metadata(defaultValue = ServiceCallConstants.SERVICE_PORT)
private String portHeader = ServiceCallConstants.SERVICE_PORT;
+ @XmlElementRef(required = false)
+ private ExpressionDefinition expressionType;
+ @XmlTransient
+ private Expression expression;
public ServiceCallExpressionConfiguration() {
this(null, null);
@@ -153,6 +160,22 @@ public class ServiceCallExpressionConfiguration extends IdentifiedType implement
this.portHeader = portHeader;
}
+ public ExpressionDefinition getExpressionType() {
+ return expressionType;
+ }
+
+ public void setExpressionType(ExpressionDefinition expressionType) {
+ this.expressionType = expressionType;
+ }
+
+ public Expression getExpression() {
+ return expression;
+ }
+
+ public void setExpression(Expression expression) {
+ this.expression = expression;
+ }
+
/**
* The header that holds the service host information, default ServiceCallConstants.SERVICE_HOST
*/
@@ -169,54 +192,77 @@ public class ServiceCallExpressionConfiguration extends IdentifiedType implement
return this;
}
+ public ServiceCallExpressionConfiguration expressionType(ExpressionDefinition expressionType) {
+ setExpressionType(expressionType);
+ return this;
+ }
+
+ public ServiceCallExpressionConfiguration expression(Expression expression) {
+ setExpression(expression);
+ return this;
+ }
+
// *************************************************************************
// Factory
// *************************************************************************
@Override
public Expression newInstance(CamelContext camelContext) throws Exception {
- ObjectHelper.notNull(factoryKey, "Expression factoryKey");
-
- Expression answer;
+ Expression answer = getExpression();
+ if (answer != null) {
+ return answer;
+ }
- // First try to find the factory from the registry.
- ServiceExpressionFactory factory = CamelContextHelper.lookup(camelContext, factoryKey, ServiceExpressionFactory.class);
- if (factory != null) {
- // If a factory is found in the registry do not re-configure it as
- // it should be pre-configured.
- answer = factory.newInstance(camelContext);
- } else {
+ ExpressionDefinition expressionType = getExpressionType();
+ if (expressionType != null && answer == null) {
+ return expressionType.createExpression(camelContext);
+ }
- Class<?> type;
- try {
- // Then use Service factory.
- type = camelContext.getFactoryFinder(RESOURCE_PATH).findClass(factoryKey);
- } catch (Exception e) {
- throw new NoFactoryAvailableException(RESOURCE_PATH + factoryKey, e);
- }
+ if (factoryKey != null) {
+ // First try to find the factory from the registry.
+ ServiceExpressionFactory factory = CamelContextHelper.lookup(camelContext, factoryKey, ServiceExpressionFactory.class);
+ if (factory != null) {
+ // If a factory is found in the registry do not re-configure it as
+ // it should be pre-configured.
+ answer = factory.newInstance(camelContext);
+ } else {
+
+ Class<?> type;
+ try {
+ // Then use Service factory.
+ type = camelContext.getFactoryFinder(RESOURCE_PATH).findClass(factoryKey);
+ } catch (Exception e) {
+ throw new NoFactoryAvailableException(RESOURCE_PATH + factoryKey, e);
+ }
- if (type != null) {
- if (ServiceExpressionFactory.class.isAssignableFrom(type)) {
- factory = (ServiceExpressionFactory) camelContext.getInjector().newInstance(type);
- } else {
- throw new IllegalArgumentException(
- "Resolving Expression: " + factoryKey + " detected type conflict: Not a ExpressionFactory implementation. Found: " + type.getName());
+ if (type != null) {
+ if (ServiceExpressionFactory.class.isAssignableFrom(type)) {
+ factory = (ServiceExpressionFactory) camelContext.getInjector().newInstance(type);
+ } else {
+ throw new IllegalArgumentException(
+ "Resolving Expression: " + factoryKey + " detected type conflict: Not a ExpressionFactory implementation. Found: " + type.getName());
+ }
}
- }
- try {
- Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(this, parameters, null, false);
- parameters.put("properties", getPropertiesAsMap(camelContext));
+ try {
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(this, parameters, null, false);
+ parameters.put("properties", getPropertiesAsMap(camelContext));
- postProcessFactoryParameters(camelContext, parameters);
+ postProcessFactoryParameters(camelContext, parameters);
- IntrospectionSupport.setProperties(factory, parameters);
+ IntrospectionSupport.setProperties(factory, parameters);
- answer = factory.newInstance(camelContext);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
+ answer = factory.newInstance(camelContext);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
}
+ } else {
+ answer = new DefaultServiceCallExpression(
+ ObjectHelper.notNull(hostHeader, "hostHeader"),
+ ObjectHelper.notNull(portHeader, "portHeader")
+ );
}
return answer;
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java b/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
index 00dfe35..e193c6e 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
@@ -25,6 +25,8 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.SimpleRegistry;
import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
+import org.apache.camel.model.cloud.ServiceCallExpressionConfiguration;
+import org.apache.camel.model.language.SimpleExpression;
import org.junit.Assert;
import org.junit.Test;
@@ -319,6 +321,50 @@ public class ServiceCallConfigurationTest {
}
// **********************************************
+ // test placeholders
+ // **********************************************
+
+ @Test
+ public void testExpression() throws Exception {
+ CamelContext context = null;
+
+ try {
+ ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition();
+ config.setServiceDiscovery(new StaticServiceDiscovery());
+ config.setExpressionConfiguration(
+ new ServiceCallExpressionConfiguration().expression(
+ new SimpleExpression("file:${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}")
+ )
+ );
+
+ context = new DefaultCamelContext();
+ context.setServiceCallConfiguration(config);
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .routeId("default")
+ .serviceCall("scall");
+ }
+ });
+
+ context.start();
+
+ DefaultServiceCallProcessor proc = findServiceCallProcessor(context.getRoute("default"));
+
+ Assert.assertNotNull(proc);
+ Assert.assertTrue(proc.getExpression() instanceof SimpleExpression);
+
+ } finally {
+ if (context != null) {
+ context.stop();
+ }
+ }
+
+ context.stop();
+ }
+
+ // **********************************************
// Helper
// **********************************************
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java
new file mode 100644
index 0000000..f7a4448
--- /dev/null
+++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.consul.cloud;
+
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringConsulExpressionServiceCallRouteTest extends SpringConsulServiceCallRouteTest {
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.xml");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-consul/src/test/resources/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-consul/src/test/resources/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.xml b/components/camel-consul/src/test/resources/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.xml
new file mode 100644
index 0000000..9b463f8
--- /dev/null
+++ b/components/camel-consul/src/test/resources/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <!-- ************************************* -->
+ <!-- ServiceCall -->
+ <!-- ************************************* -->
+
+ <defaultServiceCallConfiguration id="default">
+ <!-- service discovery -->
+ <consulServiceDiscovery url="http://localhost:8500"/>
+
+ <!-- service filter -->
+ <blacklistServiceFilter>
+ <servers>http-service-1@127.0.0.1:9011</servers>
+ <servers>http-service-2@127.0.0.1:9021</servers>
+ </blacklistServiceFilter>
+ </defaultServiceCallConfiguration>
+
+ <serviceCallConfiguration id="service-2">
+ <!-- service filter -->
+ <blacklistServiceFilter>
+ <servers>http-service-2@127.0.0.1:9022</servers>
+ </blacklistServiceFilter>
+ <expression>
+ <simple>http4:${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello</simple>
+ </expression>
+ </serviceCallConfiguration>
+
+ <!-- ************************************* -->
+ <!-- Routes -->
+ <!-- ************************************* -->
+
+ <route>
+ <from uri="direct:start"/>
+ <choice>
+ <when>
+ <simple>${body} == 'service-1'</simple>
+ <serviceCall name="http-service-1"/>
+ <to uri="mock:result-1"/>
+ </when>
+ <when>
+ <simple>${body} == 'service-2'</simple>
+ <serviceCall name="http-service-2" configurationRef="service-2"/>
+ <to uri="mock:result-2"/>
+ </when>
+ </choice>
+ </route>
+
+ <!-- ************************************* -->
+ <!-- http-service-1 -->
+ <!-- ************************************* -->
+
+ <route>
+ <from uri="jetty:http://localhost:9011"/>
+ <transform>
+ <simple>${body} 9011</simple>
+ </transform>
+ </route>
+
+ <route>
+ <from uri="jetty:http://localhost:9012"/>
+ <transform>
+ <simple>${body} 9012</simple>
+ </transform>
+ </route>
+
+ <route>
+ <from uri="jetty:http://localhost:9013"/>
+ <transform>
+ <simple>${body} 9013</simple>
+ </transform>
+ </route>
+
+ <!-- ************************************* -->
+ <!-- http-service-2 -->
+ <!-- ************************************* -->
+
+ <route>
+ <from uri="jetty:http://localhost:9021/hello"/>
+ <transform>
+ <simple>${body} 9021</simple>
+ </transform>
+ </route>
+
+ <route>
+ <from uri="jetty:http://localhost:9022/hello"/>
+ <transform>
+ <simple>${body} 9022</simple>
+ </transform>
+ </route>
+
+ <route>
+ <from uri="jetty:http://localhost:9023/hello"/>
+ <transform>
+ <simple>${body} 9023</simple>
+ </transform>
+ </route>
+
+
+
+ </camelContext>
+
+</beans>
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
index 1742745..937e042 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
@@ -98,10 +98,15 @@ public class CamelCloudConfigurationProperties {
private String loadBalancer;
/**
- * Set a custom {@link Expression} using the {@link org.apache.camel.language.simple.SimpleLanguage}
+ * The {@link Expression} to use.
*/
private String expression;
+ /**
+ * The {@link Expression} language to use, default is ref
+ */
+ private String expressionLanguage = "ref";
+
public String getUri() {
return uri;
}
@@ -157,6 +162,14 @@ public class CamelCloudConfigurationProperties {
public void setExpression(String expression) {
this.expression = expression;
}
+
+ public String getExpressionLanguage() {
+ return expressionLanguage;
+ }
+
+ public void setExpressionLanguage(String expressionLanguage) {
+ this.expressionLanguage = expressionLanguage;
+ }
}
// *****************************************
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationAutoConfiguration.java
index dadd7f0..84bdcab 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationAutoConfiguration.java
@@ -17,8 +17,12 @@
package org.apache.camel.spring.boot.cloud;
import org.apache.camel.CamelContext;
+import org.apache.camel.Expression;
import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
import org.apache.camel.model.cloud.ServiceCallConstants;
+import org.apache.camel.model.language.RefExpression;
+import org.apache.camel.model.language.SimpleExpression;
+import org.apache.camel.spi.Language;
import org.apache.camel.spring.boot.util.GroupCondition;
import org.apache.camel.util.ObjectHelper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -51,7 +55,18 @@ public class CamelCloudServiceCallConfigurationAutoConfiguration {
ObjectHelper.ifNotEmpty(configurationProperties.getServiceCall().getServiceFilter(), definition::setServiceFilterRef);
ObjectHelper.ifNotEmpty(configurationProperties.getServiceCall().getServiceChooser(), definition::setServiceChooserRef);
ObjectHelper.ifNotEmpty(configurationProperties.getServiceCall().getLoadBalancer(), definition::setLoadBalancerRef);
- ObjectHelper.ifNotEmpty(configurationProperties.getServiceCall().getExpression(), definition::setSimpleExpression);
+
+ String expression = configurationProperties.getServiceCall().getExpression();
+ String expressionLanguage = configurationProperties.getServiceCall().getExpressionLanguage();
+
+ if (ObjectHelper.isNotEmpty(expression) && ObjectHelper.isNotEmpty(expressionLanguage)) {
+ Language language = camelContext.resolveLanguage(expressionLanguage);
+ if (language == null) {
+ throw new IllegalArgumentException("Unable to resolve language: " + expressionLanguage);
+ }
+
+ definition.setExpression(language.createExpression(expression));
+ }
return definition;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
deleted file mode 100644
index ce4c037..0000000
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.spring.boot.cloud;
-
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@DirtiesContext
-@RunWith(SpringRunner.class)
-@SpringBootApplication
-@SpringBootTest(
- classes = {
- CamelAutoConfiguration.class,
- CamelCloudServiceCallExpressionTest.TestConfiguration.class
- },
- properties = {
- "service.name=custom-svc-list",
- "camel.cloud.load-balancer.enabled=false",
- "camel.cloud.service-call.component=jetty",
- "camel.cloud.service-call.expression=${header.CamelServiceCallScheme}:http://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello",
- "camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
- "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
- "ribbon.enabled=false",
- "debug=true"
- }
-)
-public class CamelCloudServiceCallExpressionTest {
- @Autowired
- private ProducerTemplate template;
-
- @Test
- public void testServiceCall() throws Exception {
- Assert.assertEquals("9090", template.requestBody("direct:start", null, String.class));
- Assert.assertEquals("9092", template.requestBody("direct:start", null, String.class));
- }
-
- // *************************************
- // Config
- // *************************************
-
- @Configuration
- public static class TestConfiguration {
- @Bean
- public RouteBuilder myRouteBuilder() {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start")
- .serviceCall("{{service.name}}");
-
- from("jetty:http://localhost:9090/hello")
- .transform()
- .constant("9090");
- from("jetty:http://localhost:9091/hello")
- .transform()
- .constant("9091");
- from("jetty:http://localhost:9092/hello")
- .transform()
- .constant("9092");
- }
- };
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
new file mode 100644
index 0000000..3d47b03
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import org.apache.camel.Expression;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.language.SimpleExpression;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ CamelCloudServiceCallRefExpressionTest.TestConfiguration.class
+ },
+ properties = {
+ "service.name=custom-svc-list",
+ "camel.cloud.load-balancer.enabled=false",
+ "camel.cloud.service-call.component=jetty",
+ "camel.cloud.service-call.expression=myExpression",
+ "camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
+ "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
+ "ribbon.enabled=false",
+ "debug=true"
+ }
+)
+public class CamelCloudServiceCallRefExpressionTest {
+ @Autowired
+ private ProducerTemplate template;
+
+ @Test
+ public void testServiceCall() throws Exception {
+ Assert.assertEquals("9090", template.requestBody("direct:start", null, String.class));
+ Assert.assertEquals("9092", template.requestBody("direct:start", null, String.class));
+ }
+
+ // *************************************
+ // Config
+ // *************************************
+
+ @Configuration
+ public static class TestConfiguration {
+ @Bean
+ Expression myExpression() {
+ return new SimpleExpression(
+ "jetty:http://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello"
+ );
+ }
+
+ @Bean
+ public RouteBuilder myRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .serviceCall("{{service.name}}");
+
+ from("jetty:http://localhost:9090/hello")
+ .transform()
+ .constant("9090");
+ from("jetty:http://localhost:9091/hello")
+ .transform()
+ .constant("9091");
+ from("jetty:http://localhost:9092/hello")
+ .transform()
+ .constant("9092");
+ }
+ };
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
new file mode 100644
index 0000000..82824e3
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ CamelCloudServiceCallSimpleExpressionTest.TestConfiguration.class
+ },
+ properties = {
+ "service.name=custom-svc-list",
+ "camel.cloud.load-balancer.enabled=false",
+ "camel.cloud.service-call.component=jetty",
+ "camel.cloud.service-call.expression=${header.CamelServiceCallScheme}:http://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello",
+ "camel.cloud.service-call.expression-language=simple",
+ "camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
+ "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
+ "ribbon.enabled=false",
+ "debug=true"
+ }
+)
+public class CamelCloudServiceCallSimpleExpressionTest {
+ @Autowired
+ private ProducerTemplate template;
+
+ @Test
+ public void testServiceCall() throws Exception {
+ Assert.assertEquals("9090", template.requestBody("direct:start", null, String.class));
+ Assert.assertEquals("9092", template.requestBody("direct:start", null, String.class));
+ }
+
+ // *************************************
+ // Config
+ // *************************************
+
+ @Configuration
+ public static class TestConfiguration {
+ @Bean
+ public RouteBuilder myRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .serviceCall("{{service.name}}");
+
+ from("jetty:http://localhost:9090/hello")
+ .transform()
+ .constant("9090");
+ from("jetty:http://localhost:9091/hello")
+ .transform()
+ .constant("9091");
+ from("jetty:http://localhost:9092/hello")
+ .transform()
+ .constant("9092");
+ }
+ };
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
index d988a18..ed60528 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
@@ -16,12 +16,14 @@
*/
package org.apache.camel.spring.cloud;
+import org.apache.camel.impl.cloud.ServiceCallConstants;
import org.apache.camel.model.cloud.AggregatingServiceCallServiceDiscoveryConfiguration;
import org.apache.camel.model.cloud.BlacklistServiceCallServiceFilterConfiguration;
import org.apache.camel.model.cloud.ChainedServiceCallServiceFilterConfiguration;
import org.apache.camel.model.cloud.DefaultServiceCallLoadBalancerConfiguration;
import org.apache.camel.model.cloud.HealthyServiceCallServiceFilterConfiguration;
import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
+import org.apache.camel.model.cloud.ServiceCallExpressionConfiguration;
import org.apache.camel.model.cloud.StaticServiceCallServiceDiscoveryConfiguration;
import org.apache.camel.spring.SpringCamelContext;
import org.junit.Test;
@@ -37,35 +39,56 @@ public class ServiceCallConfigurationTest {
public void testServiceDiscoveryConfiguration() {
SpringCamelContext context = createContext("org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml");
- ServiceCallConfigurationDefinition conf1 = context.getServiceCallConfiguration("conf1");
- assertNotNull("No ServiceCallConfiguration (1)", conf1);
- assertNotNull("No ServiceDiscoveryConfiguration (1)", conf1.getServiceDiscoveryConfiguration());
- assertNotNull("No ServiceCallLoadBalancerConfiguration (1)", conf1.getLoadBalancerConfiguration());
- assertTrue(conf1.getLoadBalancerConfiguration() instanceof DefaultServiceCallLoadBalancerConfiguration);
+ testConfiguration1(context.getServiceCallConfiguration("conf1"));
+ testConfiguration2(context.getServiceCallConfiguration("conf2"));
+ }
+
+ protected void testConfiguration1(ServiceCallConfigurationDefinition conf) {
+ assertNotNull("conf1", conf);
+
+ assertNotNull("No ServiceCallConfiguration (1)", conf);
+ assertNotNull("No ServiceDiscoveryConfiguration (1)", conf.getServiceDiscoveryConfiguration());
+ assertNotNull("No ServiceCallLoadBalancerConfiguration (1)", conf.getLoadBalancerConfiguration());
+ assertTrue(conf.getLoadBalancerConfiguration() instanceof DefaultServiceCallLoadBalancerConfiguration);
+
+ ServiceCallExpressionConfiguration expConf1 = conf.getExpressionConfiguration();
+ assertNull(expConf1.getExpression());
+ assertNotNull("No ServiceCallExpressionConfiguration (1)", expConf1.getExpressionType());
+ assertEquals(ServiceCallConstants.SERVICE_HOST, expConf1.getHostHeader());
+ assertEquals(ServiceCallConstants.SERVICE_PORT, expConf1.getPortHeader());
- StaticServiceCallServiceDiscoveryConfiguration discovery1 = (StaticServiceCallServiceDiscoveryConfiguration)conf1.getServiceDiscoveryConfiguration();
+ StaticServiceCallServiceDiscoveryConfiguration discovery1 = (StaticServiceCallServiceDiscoveryConfiguration)conf.getServiceDiscoveryConfiguration();
assertEquals(1, discovery1.getServers().size());
assertEquals("localhost:9091", discovery1.getServers().get(0));
+ }
+
+ protected void testConfiguration2(ServiceCallConfigurationDefinition conf) {
+ assertNotNull("conf2", conf);
- ServiceCallConfigurationDefinition conf2 = context.getServiceCallConfiguration("conf2");
- assertNotNull("No ServiceCallConfiguration (2)", conf2);
- assertNotNull("No ServiceDiscoveryConfiguration (2)", conf2.getServiceDiscoveryConfiguration());
- assertNull(conf2.getLoadBalancerConfiguration());
+ assertNotNull("No ServiceCallConfiguration (2)", conf);
+ assertNotNull("No ServiceDiscoveryConfiguration (2)", conf.getServiceDiscoveryConfiguration());
+ assertNull(conf.getLoadBalancerConfiguration());
- AggregatingServiceCallServiceDiscoveryConfiguration discovery2 = (AggregatingServiceCallServiceDiscoveryConfiguration)conf2.getServiceDiscoveryConfiguration();
+ AggregatingServiceCallServiceDiscoveryConfiguration discovery2 = (AggregatingServiceCallServiceDiscoveryConfiguration)conf.getServiceDiscoveryConfiguration();
assertEquals(2, discovery2.getServiceDiscoveryConfigurations().size());
assertTrue(discovery2.getServiceDiscoveryConfigurations().get(0) instanceof StaticServiceCallServiceDiscoveryConfiguration);
assertTrue(discovery2.getServiceDiscoveryConfigurations().get(1) instanceof StaticServiceCallServiceDiscoveryConfiguration);
+ ServiceCallExpressionConfiguration expconf = conf.getExpressionConfiguration();
+ assertNull(expconf.getExpression());
+ assertNull(expconf.getExpressionType());
+ assertEquals("MyHostHeader", expconf.getHostHeader());
+ assertEquals("MyPortHeader", expconf.getPortHeader());
+
StaticServiceCallServiceDiscoveryConfiguration sconf1 = (StaticServiceCallServiceDiscoveryConfiguration)discovery2.getServiceDiscoveryConfigurations().get(0);
assertEquals(1, sconf1.getServers().size());
assertEquals("localhost:9092", sconf1.getServers().get(0));
- StaticServiceCallServiceDiscoveryConfiguration sconf2 = (StaticServiceCallServiceDiscoveryConfiguration)discovery2.getServiceDiscoveryConfigurations().get(1);
- assertEquals(1, sconf2.getServers().size());
- assertEquals("localhost:9093,localhost:9094,localhost:9095,localhost:9096", sconf2.getServers().get(0));
+ StaticServiceCallServiceDiscoveryConfiguration sconf = (StaticServiceCallServiceDiscoveryConfiguration)discovery2.getServiceDiscoveryConfigurations().get(1);
+ assertEquals(1, sconf.getServers().size());
+ assertEquals("localhost:9093,localhost:9094,localhost:9095,localhost:9096", sconf.getServers().get(0));
- ChainedServiceCallServiceFilterConfiguration filter = (ChainedServiceCallServiceFilterConfiguration)conf2.getServiceFilterConfiguration();
+ ChainedServiceCallServiceFilterConfiguration filter = (ChainedServiceCallServiceFilterConfiguration)conf.getServiceFilterConfiguration();
assertEquals(2, filter.getServiceFilterConfigurations().size());
assertTrue(filter.getServiceFilterConfigurations().get(0) instanceof HealthyServiceCallServiceFilterConfiguration);
assertTrue(filter.getServiceFilterConfigurations().get(1) instanceof BlacklistServiceCallServiceFilterConfiguration);
http://git-wip-us.apache.org/repos/asf/camel/blob/f01bb49d/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
index c6851c8..7aada5e 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
@@ -30,6 +30,9 @@
<servers>localhost:9091</servers>
</staticServiceDiscovery>
<defaultLoadBalancer/>
+ <expression>
+ <simple>http:${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}"</simple>
+ </expression>
</serviceCallConfiguration>
<serviceCallConfiguration id="conf2">
@@ -47,6 +50,7 @@
<servers>localhost:9095,localhost:9096</servers>
</blacklistServiceFilter>
</chainedServiceFilter>
+ <expression hostHeader="MyHostHeader" portHeader="MyPortHeader"/>
</serviceCallConfiguration>
<route id="test1">