This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 520f7eb Move cloud out of camel-core (#2862)
520f7eb is described below
commit 520f7eb892f521e9b6ff910b23aa0396763e1849
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Apr 6 12:30:54 2019 +0200
Move cloud out of camel-core (#2862)
CAMEL-13380: camel-core - Move cloud out into camel-cloud component.
Upgrade karaf features version
---
apache-camel/pom.xml | 4 +
apache-camel/src/main/descriptors/common-bin.xml | 1 +
bom/camel-bom/pom.xml | 5 +
components/camel-cdi/pom.xml | 6 +
components/camel-consul/pom.xml | 3 +-
components/camel-dns/pom.xml | 3 +-
components/camel-etcd/pom.xml | 3 +-
components/camel-http4/pom.xml | 5 +-
components/camel-jetty-common/pom.xml | 6 +-
components/camel-kubernetes/pom.xml | 3 +-
components/camel-netty4-http/pom.xml | 4 +
components/camel-ribbon/pom.xml | 3 +-
components/camel-service/pom.xml | 3 +-
components/camel-spring-boot/pom.xml | 4 +
components/camel-test-blueprint/pom.xml | 5 +
components/camel-undertow/pom.xml | 2 +-
components/camel-zookeeper/pom.xml | 3 +-
.../src/main/java/org/apache/camel/Route.java | 1 +
.../apache/camel/cloud/DiscoverableService.java | 0
.../apache/camel/cloud/ServiceCallConstants.java | 0
.../org/apache/camel/cloud/ServiceChooser.java | 0
.../apache/camel/cloud/ServiceChooserAware.java | 0
.../apache/camel/cloud/ServiceChooserFactory.java | 0
.../org/apache/camel/cloud/ServiceDefinition.java | 0
.../org/apache/camel/cloud/ServiceDiscovery.java | 0
.../apache/camel/cloud/ServiceDiscoveryAware.java | 0
.../camel/cloud/ServiceDiscoveryFactory.java | 0
.../camel/cloud/ServiceExpressionFactory.java | 0
.../org/apache/camel/cloud/ServiceFactory.java | 0
.../java/org/apache/camel/cloud/ServiceFilter.java | 0
.../org/apache/camel/cloud/ServiceFilterAware.java | 0
.../apache/camel/cloud/ServiceFilterFactory.java | 0
.../java/org/apache/camel/cloud/ServiceHealth.java | 0
.../apache/camel/cloud/ServiceLoadBalancer.java | 0
.../camel/cloud/ServiceLoadBalancerFactory.java | 0
.../camel/cloud/ServiceLoadBalancerFunction.java | 0
.../org/apache/camel/cloud/ServiceRegistry.java | 0
.../main/java/org/apache/camel/cloud/package.html | 0
.../org/apache/camel/spi/ProcessorFactory.java | 15 +
.../camel-http4 => core/camel-cloud}/pom.xml | 80 ++--
.../camel/impl/cloud/AbstractServiceRegistry.java | 0
.../camel/impl/cloud/BlacklistServiceFilter.java | 0
.../impl/cloud/BlacklistServiceFilterFactory.java | 0
.../camel/impl/cloud/CachingServiceDiscovery.java | 0
.../impl/cloud/CachingServiceDiscoveryFactory.java | 0
.../camel/impl/cloud/CombinedServiceDiscovery.java | 0
.../cloud/CombinedServiceDiscoveryFactory.java | 0
.../camel/impl/cloud/CombinedServiceFilter.java | 0
.../impl/cloud/CombinedServiceFilterFactory.java | 0
.../impl/cloud/DefaultServiceCallExpression.java | 4 +-
.../impl/cloud/DefaultServiceCallProcessor.java | 32 +-
.../camel/impl/cloud/DefaultServiceDefinition.java | 0
.../camel/impl/cloud/DefaultServiceDiscovery.java | 0
.../camel/impl/cloud/DefaultServiceFilter.java | 0
.../camel/impl/cloud/DefaultServiceHealth.java | 0
.../impl/cloud/DefaultServiceLoadBalancer.java | 0
.../cloud/DefaultServiceLoadBalancerFactory.java | 0
.../camel/impl/cloud/HealthyServiceFilter.java | 0
.../impl/cloud/HealthyServiceFilterFactory.java | 0
.../camel/impl/cloud/PassThroughServiceFilter.java | 0
.../cloud/PassThroughServiceFilterFactory.java | 0
.../camel/impl/cloud/RandomServiceChooser.java | 0
.../camel/impl/cloud/RoundRobinServiceChooser.java | 0
.../impl}/cloud/ServiceCallExpressionSupport.java | 3 +-
.../impl/cloud/ServiceCallProcessorFactory.java} | 157 ++++----
.../impl/cloud/ServiceRegistrationRoutePolicy.java | 5 +-
.../ServiceRegistrationRoutePolicyFactory.java | 0
.../camel/impl/cloud/ServiceRegistryHelper.java | 0
.../camel/impl/cloud/ServiceRegistrySelectors.java | 0
.../camel/impl/cloud/StaticServiceDiscovery.java | 0
.../impl/cloud/StaticServiceDiscoveryFactory.java | 0
.../java/org/apache/camel/impl/cloud/package.html | 0
.../org/apache/camel/model/ServiceCallDefinition | 18 +
.../impl/cloud/CachingServiceDiscoveryTest.java | 0
.../impl/cloud/CombinedServiceDiscoveryTest.java | 0
.../impl/cloud/CombinedServiceFilterTest.java | 0
.../apache/camel/impl/cloud/LoadBalancerTest.java | 0
.../impl/cloud/ServiceCallConfigurationTest.java | 0
.../camel/impl/cloud/ServiceDefinitionTest.java | 0
.../camel/impl/cloud/ServiceRegistryTest.java | 0
.../src/test/resources/log4j2.properties | 33 ++
.../apache/camel/impl/DefaultProcessorFactory.java | 25 ++
.../apache/camel/impl/DefaultProducerCache.java | 2 +-
.../org/apache/camel/impl/DefaultRouteContext.java | 1 +
.../apache/camel/impl/TypedProcessorFactory.java | 7 +
.../cloud/ServiceCallExpressionConfiguration.java | 7 -
.../camel/processor/SendDynamicProcessor.java | 5 -
.../apache/camel/reifier/ServiceCallReifier.java | 431 +--------------------
.../processor/CustomProcessorFactoryTest.java | 9 +
core/pom.xml | 1 +
.../service/src/main/bash/consul-run-linux.sh | 2 +-
.../service/src/main/bash/consul-run-osx.sh | 2 +-
.../services/src/main/bash/consul-run-linux.sh | 2 +-
.../services/src/main/bash/consul-run-osx.sh | 2 +-
.../README.adoc | 2 +-
.../service/src/main/bash/consul-run-linux.sh | 2 +-
.../service/src/main/bash/consul-run-osx.sh | 2 +-
parent/pom.xml | 5 +
.../karaf/features/src/main/resources/features.xml | 3 +-
.../camel-spring-boot-dependencies/pom.xml | 5 +
100 files changed, 314 insertions(+), 612 deletions(-)
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 7bf678f..2f8f64a 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -84,6 +84,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-xml</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ </dependency>
<!-- NOTE: auto-generated list of components when building camel
catalog -->
<!-- camel components: START -->
diff --git a/apache-camel/src/main/descriptors/common-bin.xml
b/apache-camel/src/main/descriptors/common-bin.xml
index e3e94ea..8f3ba61 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -36,6 +36,7 @@
<include>org.apache.camel:camel-core</include>
<include>org.apache.camel:camel-core-osgi</include>
<include>org.apache.camel:camel-core-xml</include>
+ <include>org.apache.camel:camel-cloud</include>
<!-- NOTE: auto-generated list of components when building camel
catalog -->
<!-- camel components: START -->
diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index e6c1dbb..13af97a 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -553,6 +553,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-cm-sms</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/components/camel-cdi/pom.xml b/components/camel-cdi/pom.xml
index 8c4f7f6..7a605ca 100644
--- a/components/camel-cdi/pom.xml
+++ b/components/camel-cdi/pom.xml
@@ -125,6 +125,12 @@
<!-- test dependencies -->
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/components/camel-consul/pom.xml b/components/camel-consul/pom.xml
index 6d18805..9ad068e 100644
--- a/components/camel-consul/pom.xml
+++ b/components/camel-consul/pom.xml
@@ -37,10 +37,9 @@
</properties>
<dependencies>
- <!-- core required: org.apache.camel.cloud,
org.apache.camel.impl.cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>com.orbitz.consul</groupId>
diff --git a/components/camel-dns/pom.xml b/components/camel-dns/pom.xml
index 22e8805..b609249 100644
--- a/components/camel-dns/pom.xml
+++ b/components/camel-dns/pom.xml
@@ -34,10 +34,9 @@
<dependencies>
- <!-- requires camel-core -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>dnsjava</groupId>
diff --git a/components/camel-etcd/pom.xml b/components/camel-etcd/pom.xml
index f009e24..1cc81e1 100644
--- a/components/camel-etcd/pom.xml
+++ b/components/camel-etcd/pom.xml
@@ -38,10 +38,9 @@
<dependencies>
- <!-- requires camel-core due camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<!-- etcd -->
diff --git a/components/camel-http4/pom.xml b/components/camel-http4/pom.xml
index 7422b61..9969b23 100644
--- a/components/camel-http4/pom.xml
+++ b/components/camel-http4/pom.xml
@@ -34,9 +34,8 @@
<description>Camel HTTP (Apache HttpClient 4.x) support</description>
<properties>
- <!-- CAMEL-7010 Now we move to HttpClient 4.3 API -->
<camel.osgi.import.before.defaults>
- org.apache.http.*;version="[4.3,5)"
+ org.apache.http.*;version="[4.4,5)"
</camel.osgi.import.before.defaults>
</properties>
@@ -44,7 +43,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-jetty-common/pom.xml
b/components/camel-jetty-common/pom.xml
index c6a37a4..8b4b9f1 100644
--- a/components/camel-jetty-common/pom.xml
+++ b/components/camel-jetty-common/pom.xml
@@ -31,11 +31,11 @@
<packaging>jar</packaging>
<name>Camel :: Jetty :: Common</name>
- <description>Camel Jetty 8.x/9.x support</description>
+ <description>Camel Jetty 9.x support</description>
<properties>
<camel.osgi.import.before.defaults>
- org.eclipse.jetty.*;version="[9.3,10)",
+ org.eclipse.jetty.*;version="[9.4,10)",
javax.servlet.*;version="${servlet-version-range}"
</camel.osgi.import.before.defaults>
</properties>
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-kubernetes/pom.xml
b/components/camel-kubernetes/pom.xml
index ec85bd6..8fca3ec 100644
--- a/components/camel-kubernetes/pom.xml
+++ b/components/camel-kubernetes/pom.xml
@@ -36,10 +36,9 @@
</properties>
<dependencies>
- <!-- requires camel-core due camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
diff --git a/components/camel-netty4-http/pom.xml
b/components/camel-netty4-http/pom.xml
index 1867f2a..dd08d5b 100644
--- a/components/camel-netty4-http/pom.xml
+++ b/components/camel-netty4-http/pom.xml
@@ -46,6 +46,10 @@
<artifactId>camel-http-common</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api-version}</version>
diff --git a/components/camel-ribbon/pom.xml b/components/camel-ribbon/pom.xml
index 611490b..8ce01f9 100644
--- a/components/camel-ribbon/pom.xml
+++ b/components/camel-ribbon/pom.xml
@@ -41,10 +41,9 @@
<dependencies>
- <!-- needs camel-core because of camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
diff --git a/components/camel-service/pom.xml b/components/camel-service/pom.xml
index 4cf8608..6e96f8c 100644
--- a/components/camel-service/pom.xml
+++ b/components/camel-service/pom.xml
@@ -38,10 +38,9 @@
<dependencies>
- <!-- needs camel-core because of camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<!-- test dependencies -->
diff --git a/components/camel-spring-boot/pom.xml
b/components/camel-spring-boot/pom.xml
index 5a9acf1..1d19d7f 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -69,6 +69,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ </dependency>
<!-- JMX is enabled by default -->
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-test-blueprint/pom.xml
b/components/camel-test-blueprint/pom.xml
index 7f1a6b6..1bae325 100644
--- a/components/camel-test-blueprint/pom.xml
+++ b/components/camel-test-blueprint/pom.xml
@@ -52,6 +52,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<!-- exclude aries blueprint as we add these dependencies explicit
-->
<exclusions>
diff --git a/components/camel-undertow/pom.xml
b/components/camel-undertow/pom.xml
index 81828db..b8f5318 100644
--- a/components/camel-undertow/pom.xml
+++ b/components/camel-undertow/pom.xml
@@ -38,7 +38,7 @@
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-zookeeper/pom.xml
b/components/camel-zookeeper/pom.xml
index a60be71..952e1e4 100644
--- a/components/camel-zookeeper/pom.xml
+++ b/components/camel-zookeeper/pom.xml
@@ -38,10 +38,9 @@
<dependencies>
- <!-- requires camel-core due camel-cloud and others -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
diff --git a/core/camel-api/src/main/java/org/apache/camel/Route.java
b/core/camel-api/src/main/java/org/apache/camel/Route.java
index aeaba49..49087d9 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Route.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Route.java
@@ -33,6 +33,7 @@ import org.apache.camel.spi.RouteContext;
public interface Route extends EndpointAware {
String ID_PROPERTY = "id";
+ String CUSTOM_ID_PROPERTY = "customId";
String PARENT_PROPERTY = "parent";
String GROUP_PROPERTY = "group";
String REST_PROPERTY = "rest";
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/DiscoverableService.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/DiscoverableService.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/DiscoverableService.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/DiscoverableService.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooser.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooser.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooser.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooser.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDefinition.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDefinition.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDefinition.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDefinition.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFactory.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFactory.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFactory.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFactory.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilter.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilter.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilter.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilter.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceHealth.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceHealth.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceHealth.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceHealth.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceRegistry.java
b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceRegistry.java
similarity index 100%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceRegistry.java
rename to
core/camel-api/src/main/java/org/apache/camel/cloud/ServiceRegistry.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/package.html
b/core/camel-api/src/main/java/org/apache/camel/cloud/package.html
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/package.html
rename to core/camel-api/src/main/java/org/apache/camel/cloud/package.html
diff --git
a/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java
b/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java
index cf750e6..b88cf57 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.spi;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
import org.apache.camel.NamedNode;
import org.apache.camel.Processor;
@@ -56,4 +59,16 @@ public interface ProcessorFactory {
*/
Processor createProcessor(RouteContext routeContext, NamedNode definition)
throws Exception;
+ /**
+ * Creates a processor by the name of the definition. This should only be
used in some special situations
+ * where the processor is used internally in some features such as
camel-cloud.
+ *
+ * @param camelContext the camel context
+ * @param definitionName the name of the definition that represents the
processor
+ * @param args arguments for creating the processor (name=vale
pairs)
+ * @return the created processor, or <tt>null</tt> if this situation is
not yet implemented.
+ * @throws Exception can be thrown if error creating the processor
+ */
+ Processor createProcessor(CamelContext camelContext, String
definitionName, Map<String, Object> args) throws Exception;
+
}
diff --git a/components/camel-http4/pom.xml b/core/camel-cloud/pom.xml
similarity index 64%
copy from components/camel-http4/pom.xml
copy to core/camel-cloud/pom.xml
index 7422b61..54c7721 100644
--- a/components/camel-http4/pom.xml
+++ b/core/camel-cloud/pom.xml
@@ -18,98 +18,96 @@
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel</groupId>
- <artifactId>components</artifactId>
+ <artifactId>core</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
- <artifactId>camel-http4</artifactId>
+ <artifactId>camel-cloud</artifactId>
<packaging>jar</packaging>
-
- <name>Camel :: HTTP4</name>
- <description>Camel HTTP (Apache HttpClient 4.x) support</description>
+ <name>Camel :: Cloud</name>
+ <description>Camel Cloud support</description>
<properties>
- <!-- CAMEL-7010 Now we move to HttpClient 4.3 API -->
- <camel.osgi.import.before.defaults>
- org.apache.http.*;version="[4.3,5)"
- </camel.osgi.import.before.defaults>
+ <firstVersion>3.0</firstVersion>
+ <label>cloud</label>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <artifactId>apt</artifactId>
+ <scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-http-common</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${javax.servlet-api-version}</version>
+ <artifactId>spi-annotations</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>meta-annotations</artifactId>
+ <optional>true</optional>
</dependency>
- <!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-management-impl</artifactId>
- <scope>test</scope>
+ <artifactId>camel-core</artifactId>
</dependency>
+
+ <!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-core</artifactId>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>java-hamcrest</artifactId>
<scope>test</scope>
</dependency>
+
+ <!-- logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${httpclient4-version}</version>
- <classifier>tests</classifier>
+ <artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty-version}</version>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj-version}</version>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
+
</dependencies>
+
</project>
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
similarity index 94%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
index 8b8c5ad..58ccb3e 100644
---
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
+++
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
@@ -16,13 +16,11 @@
*/
package org.apache.camel.impl.cloud;
-import org.apache.camel.cloud.ServiceCallExpressionSupport;
-import org.apache.camel.model.cloud.ServiceCallDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Support class for custom implementations of {@link ServiceCallDefinition
ServiceCall EIP} components.
+ * Support class for custom implementations of ServiceCall EIP components.
* <p/>
* Below are some examples how to call a service and what Camel endpoint URI
is constructed based on the input:
* <pre>
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
similarity index 88%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
index 9d0b4a1..5603f19 100644
---
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
+++
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
@@ -16,19 +16,22 @@
*/
package org.apache.camel.impl.cloud;
+import java.util.HashMap;
import java.util.Map;
import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Expression;
import org.apache.camel.Message;
+import org.apache.camel.Processor;
import org.apache.camel.cloud.ServiceCallConstants;
import org.apache.camel.cloud.ServiceDefinition;
import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.language.simple.SimpleLanguage;
-import org.apache.camel.processor.SendDynamicProcessor;
+import org.apache.camel.spi.Language;
+import org.apache.camel.support.AsyncProcessorConverterHelper;
import org.apache.camel.support.AsyncProcessorSupport;
import org.apache.camel.support.service.ServiceHelper;
import org.apache.camel.util.ObjectHelper;
@@ -44,7 +47,7 @@ public class DefaultServiceCallProcessor extends
AsyncProcessorSupport {
private final CamelContext camelContext;
private final ServiceLoadBalancer loadBalancer;
private final Expression expression;
- private SendDynamicProcessor processor;
+ private AsyncProcessor processor;
public DefaultServiceCallProcessor(
CamelContext camelContext, String name, String scheme, String uri,
ExchangePattern exchangePattern,
@@ -122,11 +125,13 @@ public class DefaultServiceCallProcessor extends
AsyncProcessorSupport {
ObjectHelper.notNull(expression, "expression");
ObjectHelper.notNull(loadBalancer, "load balancer");
- processor = new SendDynamicProcessor(uri, expression);
- processor.setCamelContext(camelContext);
- if (exchangePattern != null) {
- processor.setPattern(exchangePattern);
- }
+ Map<String, Object> args = new HashMap<>();
+ args.put("uri", uri);
+ args.put("expression", expression);
+ args.put("exchangePattern", exchangePattern);
+
+ Processor send =
camelContext.getProcessorFactory().createProcessor(camelContext,
"SendDynamicProcessor", args);
+ processor = AsyncProcessorConverterHelper.convert(send);
// Start services if needed
ServiceHelper.startService(processor);
@@ -204,9 +209,12 @@ public class DefaultServiceCallProcessor extends
AsyncProcessorSupport {
* @param exchange the exchange
* @return the computed expression
*/
- private String applySimpleLanguage(String expression, Exchange exchange) {
- return SimpleLanguage.hasSimpleFunction(expression)
- ? SimpleLanguage.simple(expression).evaluate(exchange,
String.class)
- : expression;
+ private static String applySimpleLanguage(String expression, Exchange
exchange) {
+ if (expression != null) {
+ Language simple = exchange.getContext().resolveLanguage("simple");
+ return simple.createExpression(expression).evaluate(exchange,
String.class);
+ } else {
+ return null;
+ }
}
}
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java
diff --git
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallExpressionSupport.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallExpressionSupport.java
similarity index 96%
rename from
core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallExpressionSupport.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallExpressionSupport.java
index 1879209..dd69366 100644
---
a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallExpressionSupport.java
+++
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallExpressionSupport.java
@@ -14,10 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.cloud;
+package org.apache.camel.impl.cloud;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.cloud.ServiceCallConstants;
import org.apache.camel.support.ExchangeHelper;
import org.apache.camel.support.ExpressionAdapter;
diff --git
a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
similarity index 75%
copy from
core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
copy to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
index 74a3457..0d9b5c0 100644
---
a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
+++
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
@@ -1,20 +1,20 @@
-/*
+/**
* 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
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
* 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.reifier;
+package org.apache.camel.impl.cloud;
import java.util.Optional;
import java.util.function.Function;
@@ -32,15 +32,8 @@ import org.apache.camel.cloud.ServiceExpressionFactory;
import org.apache.camel.cloud.ServiceFilter;
import org.apache.camel.cloud.ServiceFilterAware;
import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
-import org.apache.camel.impl.cloud.DefaultServiceCallProcessor;
-import org.apache.camel.impl.cloud.DefaultServiceLoadBalancer;
-import org.apache.camel.impl.cloud.HealthyServiceFilter;
-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.impl.TypedProcessorFactory;
import org.apache.camel.model.ModelCamelContext;
-import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinitionConstants;
@@ -49,14 +42,15 @@ import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.function.Suppliers;
import org.apache.camel.util.function.ThrowingHelper;
-
import static org.apache.camel.support.CamelContextHelper.findByType;
import static org.apache.camel.support.CamelContextHelper.lookup;
-class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
+public class ServiceCallProcessorFactory extends
TypedProcessorFactory<ServiceCallDefinition> {
+
+ private volatile ServiceCallDefinition definition;
- ServiceCallReifier(ProcessorDefinition<?> definition) {
- super((ServiceCallDefinition) definition);
+ public ServiceCallProcessorFactory() {
+ super(ServiceCallDefinition.class);
}
// *****************************
@@ -64,7 +58,9 @@ class ServiceCallReifier extends
ProcessorReifier<ServiceCallDefinition> {
// *****************************
@Override
- public Processor createProcessor(RouteContext routeContext) throws
Exception {
+ public Processor doCreateProcessor(RouteContext routeContext,
ServiceCallDefinition definition) throws Exception {
+ this.definition = definition;
+
final CamelContext camelContext = routeContext.getCamelContext();
final ServiceDiscovery serviceDiscovery =
retrieveServiceDiscovery(camelContext);
final ServiceFilter serviceFilter =
retrieveServiceFilter(camelContext);
@@ -200,22 +196,22 @@ class ServiceCallReifier extends
ProcessorReifier<ServiceCallDefinition> {
private ServiceDiscovery retrieveServiceDiscovery(CamelContext
camelContext) throws Exception {
return Suppliers.firstNotNull(
- () -> (definition.getServiceDiscoveryConfiguration() != null) ?
definition.getServiceDiscoveryConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceDiscovery.class, camelContext,
definition::getServiceDiscovery, definition::getServiceDiscoveryRef),
- // Linked configuration
- () -> retrieveServiceDiscovery(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceDiscovery(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceDiscovery.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_DISCOVERY_ID,
ServiceDiscovery.class)
+ () -> (definition.getServiceDiscoveryConfiguration() != null)
? definition.getServiceDiscoveryConfiguration().newInstance(camelContext) :
null,
+ // Local configuration
+ () -> retrieve(ServiceDiscovery.class, camelContext,
definition::getServiceDiscovery, definition::getServiceDiscoveryRef),
+ // Linked configuration
+ () -> retrieveServiceDiscovery(camelContext,
this::retrieveConfig),
+ // Default configuration
+ () -> retrieveServiceDiscovery(camelContext,
this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceDiscovery.class),
+ // From registry
+ () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_DISCOVERY_ID,
ServiceDiscovery.class)
).orElseGet(
- // Default, that's s little ugly but a load balancer may live
without
- // (i.e. the Ribbon one) so let's delegate the null check to the
actual
- // impl.
- () -> null
+ // Default, that's s little ugly but a load balancer may live
without
+ // (i.e. the Ribbon one) so let's delegate the null check to
the actual
+ // impl.
+ () -> null
);
}
@@ -256,20 +252,20 @@ class ServiceCallReifier extends
ProcessorReifier<ServiceCallDefinition> {
private ServiceFilter retrieveServiceFilter(CamelContext camelContext)
throws Exception {
return Suppliers.firstNotNull(
- () -> (definition.getServiceFilterConfiguration() != null) ?
definition.getServiceFilterConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceFilter.class, camelContext,
definition::getServiceFilter, definition::getServiceFilterRef),
- // Linked configuration
- () -> retrieveServiceFilter(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceFilter(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceFilter.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class)
+ () -> (definition.getServiceFilterConfiguration() != null) ?
definition.getServiceFilterConfiguration().newInstance(camelContext) : null,
+ // Local configuration
+ () -> retrieve(ServiceFilter.class, camelContext,
definition::getServiceFilter, definition::getServiceFilterRef),
+ // Linked configuration
+ () -> retrieveServiceFilter(camelContext,
this::retrieveConfig),
+ // Default configuration
+ () -> retrieveServiceFilter(camelContext,
this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceFilter.class),
+ // From registry
+ () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class)
).orElseGet(
- // Default
- () -> new HealthyServiceFilter()
+ // Default
+ () -> new HealthyServiceFilter()
);
}
@@ -306,19 +302,19 @@ class ServiceCallReifier extends
ProcessorReifier<ServiceCallDefinition> {
private ServiceChooser retrieveServiceChooser(CamelContext camelContext)
throws Exception {
return Suppliers.firstNotNull(
- // Local configuration
- () -> retrieve(ServiceChooser.class, camelContext,
definition::getServiceChooser, definition::getServiceChooserRef),
- // Linked configuration
- () -> retrieveServiceChooser(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceChooser(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceChooser.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class)
+ // Local configuration
+ () -> retrieve(ServiceChooser.class, camelContext,
definition::getServiceChooser, definition::getServiceChooserRef),
+ // Linked configuration
+ () -> retrieveServiceChooser(camelContext,
this::retrieveConfig),
+ // Default configuration
+ () -> retrieveServiceChooser(camelContext,
this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceChooser.class),
+ // From registry
+ () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class)
).orElseGet(
- // Default
- () -> new RoundRobinServiceChooser()
+ // Default
+ () -> new RoundRobinServiceChooser()
);
}
@@ -348,20 +344,20 @@ class ServiceCallReifier extends
ProcessorReifier<ServiceCallDefinition> {
private ServiceLoadBalancer retrieveLoadBalancer(CamelContext
camelContext) throws Exception {
return Suppliers.firstNotNull(
- () -> (definition.getLoadBalancerConfiguration() != null) ?
definition.getLoadBalancerConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceLoadBalancer.class, camelContext,
definition::getLoadBalancer, definition::getLoadBalancerRef),
- // Linked configuration
- () -> retrieveLoadBalancer(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveLoadBalancer(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceLoadBalancer.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_LOAD_BALANCER_ID,
ServiceLoadBalancer.class)
+ () -> (definition.getLoadBalancerConfiguration() != null) ?
definition.getLoadBalancerConfiguration().newInstance(camelContext) : null,
+ // Local configuration
+ () -> retrieve(ServiceLoadBalancer.class, camelContext,
definition::getLoadBalancer, definition::getLoadBalancerRef),
+ // Linked configuration
+ () -> retrieveLoadBalancer(camelContext, this::retrieveConfig),
+ // Default configuration
+ () -> retrieveLoadBalancer(camelContext,
this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceLoadBalancer.class),
+ // From registry
+ () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_LOAD_BALANCER_ID,
ServiceLoadBalancer.class)
).orElseGet(
- // Default
- () -> new DefaultServiceLoadBalancer()
+ // Default
+ () -> new DefaultServiceLoadBalancer()
);
}
@@ -391,15 +387,15 @@ class ServiceCallReifier extends
ProcessorReifier<ServiceCallDefinition> {
private Expression retrieveExpression(CamelContext camelContext, String
component) throws Exception {
Optional<Expression> expression = Suppliers.firstNotNull(
- () -> (definition.getExpressionConfiguration() != null) ?
definition.getExpressionConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(Expression.class, camelContext,
definition::getExpression, definition::getExpressionRef),
- // Linked configuration
- () -> retrieveExpression(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveExpression(camelContext,
this::retrieveDefaultConfig),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID,
Expression.class)
+ () -> (definition.getExpressionConfiguration() != null) ?
definition.getExpressionConfiguration().newInstance(camelContext) : null,
+ // Local configuration
+ () -> retrieve(Expression.class, camelContext,
definition::getExpression, definition::getExpressionRef),
+ // Linked configuration
+ () -> retrieveExpression(camelContext, this::retrieveConfig),
+ // Default configuration
+ () -> retrieveExpression(camelContext,
this::retrieveDefaultConfig),
+ // From registry
+ () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID,
Expression.class)
);
if (expression.isPresent()) {
@@ -458,5 +454,4 @@ class ServiceCallReifier extends
ProcessorReifier<ServiceCallDefinition> {
return answer;
}
-
}
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
similarity index 97%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
index ffea02d..ad48e39 100644
---
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
+++
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
@@ -28,7 +28,6 @@ import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.cloud.DiscoverableService;
import org.apache.camel.cloud.ServiceDefinition;
import org.apache.camel.cloud.ServiceRegistry;
-import org.apache.camel.model.RouteDefinition;
import org.apache.camel.support.RoutePolicySupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -167,8 +166,8 @@ public class ServiceRegistrationRoutePolicy extends
RoutePolicySupport implement
String serviceId = properties.get(ServiceDefinition.SERVICE_META_ID);
if (serviceId == null) {
// if not check if the route id is custom and use it
- RouteDefinition definition = (RouteDefinition)
route.getRouteContext().getRoute();
- if (definition.hasCustomIdAssigned()) {
+ boolean custom =
"true".equals(route.getProperties().get(Route.CUSTOM_ID_PROPERTY));
+ if (custom) {
serviceId = route.getId();
}
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/package.html
b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/package.html
similarity index 100%
rename from
core/camel-core/src/main/java/org/apache/camel/impl/cloud/package.html
rename to
core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/package.html
diff --git
a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
new file mode 100644
index 0000000..ad3c7d9
--- /dev/null
+++
b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.impl.cloud.ServiceCallProcessorFactory
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
similarity index 100%
rename from
core/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
rename to
core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java
b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java
similarity index 100%
rename from
core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java
rename to
core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java
b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java
similarity index 100%
rename from
core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java
rename to
core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java
b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java
similarity index 100%
rename from
core/camel-core/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java
rename to
core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
similarity index 100%
rename from
core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
rename to
core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java
b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java
similarity index 100%
rename from
core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java
rename to
core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java
b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java
similarity index 100%
rename from
core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java
rename to
core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java
diff --git a/core/camel-cloud/src/test/resources/log4j2.properties
b/core/camel-cloud/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..65d5151
--- /dev/null
+++ b/core/camel-cloud/src/test/resources/log4j2.properties
@@ -0,0 +1,33 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-cloud-test.log
+appender.file.append = true
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+rootLogger.level = INFO
+
+rootLogger.appenderRef.file.ref = file
+#rootLogger.appenderRef.console.ref = console
+
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
index 2a7b9a1..725e8a0 100644
---
a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
+++
b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
@@ -16,9 +16,15 @@
*/
package org.apache.camel.impl;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Expression;
import org.apache.camel.NamedNode;
import org.apache.camel.NoFactoryAvailableException;
import org.apache.camel.Processor;
+import org.apache.camel.processor.SendDynamicProcessor;
import org.apache.camel.spi.FactoryFinder;
import org.apache.camel.spi.ProcessorFactory;
import org.apache.camel.spi.RouteContext;
@@ -75,4 +81,23 @@ public class DefaultProcessorFactory implements
ProcessorFactory {
return null;
}
+
+ @Override
+ public Processor createProcessor(CamelContext camelContext, String
definitionName, Map<String, Object> args) throws Exception {
+ // currently only SendDynamicProcessor is supported
+ SendDynamicProcessor answer = null;
+ if ("SendDynamicProcessor".equals(definitionName)) {
+ String uri = (String) args.get("uri");
+ Expression expression = (Expression) args.get("expression");
+ ExchangePattern exchangePattern = (ExchangePattern)
args.get("exchangePattern");
+ answer = new SendDynamicProcessor(uri, expression);
+ answer.setCamelContext(camelContext);
+ if (exchangePattern != null) {
+ answer.setPattern(exchangePattern);
+ }
+ }
+
+ return answer;
+ }
+
}
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java
b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java
index 04b1723..48c1494 100644
---
a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java
+++
b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java
@@ -60,7 +60,7 @@ public class DefaultProducerCache extends ServiceSupport
implements ProducerCach
this.producers = new ServicePool<>(Endpoint::createAsyncProducer,
AsyncProducer::getEndpoint, maxCacheSize);
// only if JMX is enabled
- if (camelContext.getManagementStrategy().getManagementAgent() != null)
{
+ if (camelContext.getManagementStrategy() != null &&
camelContext.getManagementStrategy().getManagementAgent() != null) {
this.extendedStatistics =
camelContext.getManagementStrategy().getManagementAgent().getStatisticsLevel().isExtended();
} else {
this.extendedStatistics = false;
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
index 7f5830a..20f8539 100644
---
a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
+++
b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
@@ -229,6 +229,7 @@ public class DefaultRouteContext implements RouteContext {
// and create the route that wraps the UoW
Route edcr = new EventDrivenConsumerRoute(this, getEndpoint(),
internal);
edcr.getProperties().put(Route.ID_PROPERTY, routeId);
+ edcr.getProperties().put(Route.CUSTOM_ID_PROPERTY,
route.hasCustomIdAssigned() ? "true" : "false");
edcr.getProperties().put(Route.PARENT_PROPERTY,
Integer.toHexString(route.hashCode()));
edcr.getProperties().put(Route.DESCRIPTION_PROPERTY,
route.getDescriptionText());
if (route.getGroup() != null) {
diff --git
a/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
b/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
index e25137d..ab91921 100644
---
a/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
+++
b/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.impl;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
import org.apache.camel.NamedNode;
import org.apache.camel.Processor;
import org.apache.camel.model.ProcessorDefinition;
@@ -47,6 +50,10 @@ public class TypedProcessorFactory<T extends
ProcessorDefinition<T>> implements
return null;
}
+ @Override
+ public Processor createProcessor(CamelContext camelContext, String
definitionName, Map<String, Object> args) throws Exception {
+ return null;
+ }
protected Processor doCreateChildProcessor(RouteContext routeContext, T
definition, boolean mandatory) throws Exception {
return null;
diff --git
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
index c82c067..b52cb24 100644
---
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
+++
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
@@ -35,7 +35,6 @@ import org.apache.camel.Expression;
import org.apache.camel.NoFactoryAvailableException;
import org.apache.camel.cloud.ServiceCallConstants;
import org.apache.camel.cloud.ServiceExpressionFactory;
-import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
import org.apache.camel.model.IdentifiedType;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.PropertyDefinition;
@@ -43,7 +42,6 @@ import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.spi.Metadata;
import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.IntrospectionSupport;
-import org.apache.camel.util.ObjectHelper;
@Metadata(label = "routing,cloud")
@XmlRootElement(name = "serviceExpression")
@@ -275,11 +273,6 @@ public class ServiceCallExpressionConfiguration extends
IdentifiedType implement
throw new IllegalArgumentException(e);
}
}
- } else {
- answer = new DefaultServiceCallExpression(
- ObjectHelper.notNull(hostHeader, "hostHeader"),
- ObjectHelper.notNull(portHeader, "portHeader")
- );
}
return answer;
diff --git
a/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
b/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
index 3ac4a0a..2857dfd 100644
---
a/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
+++
b/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
@@ -55,11 +55,6 @@ public class SendDynamicProcessor extends
AsyncProcessorSupport implements IdAwa
protected int cacheSize;
protected boolean allowOptimisedComponents = true;
- public SendDynamicProcessor(Expression expression) {
- this.uri = null;
- this.expression = expression;
- }
-
public SendDynamicProcessor(String uri, Expression expression) {
this.uri = uri;
this.expression = expression;
diff --git
a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
b/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
index 74a3457..b5c1cbd 100644
---
a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
+++
b/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
@@ -16,447 +16,20 @@
*/
package org.apache.camel.reifier;
-import java.util.Optional;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.Expression;
import org.apache.camel.Processor;
-import org.apache.camel.cloud.ServiceChooser;
-import org.apache.camel.cloud.ServiceChooserAware;
-import org.apache.camel.cloud.ServiceDiscovery;
-import org.apache.camel.cloud.ServiceDiscoveryAware;
-import org.apache.camel.cloud.ServiceExpressionFactory;
-import org.apache.camel.cloud.ServiceFilter;
-import org.apache.camel.cloud.ServiceFilterAware;
-import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
-import org.apache.camel.impl.cloud.DefaultServiceCallProcessor;
-import org.apache.camel.impl.cloud.DefaultServiceLoadBalancer;
-import org.apache.camel.impl.cloud.HealthyServiceFilter;
-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.ModelCamelContext;
import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinition;
-import org.apache.camel.model.cloud.ServiceCallDefinitionConstants;
import org.apache.camel.spi.RouteContext;
-import org.apache.camel.support.CamelContextHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.function.Suppliers;
-import org.apache.camel.util.function.ThrowingHelper;
-
-import static org.apache.camel.support.CamelContextHelper.findByType;
-import static org.apache.camel.support.CamelContextHelper.lookup;
class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
ServiceCallReifier(ProcessorDefinition<?> definition) {
- super((ServiceCallDefinition) definition);
+ super(ServiceCallDefinition.class.cast(definition));
}
- // *****************************
- // Processor Factory
- // *****************************
-
@Override
public Processor createProcessor(RouteContext routeContext) throws
Exception {
- final CamelContext camelContext = routeContext.getCamelContext();
- final ServiceDiscovery serviceDiscovery =
retrieveServiceDiscovery(camelContext);
- final ServiceFilter serviceFilter =
retrieveServiceFilter(camelContext);
- final ServiceChooser serviceChooser =
retrieveServiceChooser(camelContext);
- final ServiceLoadBalancer loadBalancer =
retrieveLoadBalancer(camelContext);
-
- CamelContextAware.trySetCamelContext(serviceDiscovery, camelContext);
- CamelContextAware.trySetCamelContext(serviceFilter, camelContext);
- CamelContextAware.trySetCamelContext(serviceChooser, camelContext);
- CamelContextAware.trySetCamelContext(loadBalancer, camelContext);
-
- if (loadBalancer instanceof ServiceDiscoveryAware) {
- ((ServiceDiscoveryAware)
loadBalancer).setServiceDiscovery(serviceDiscovery);
- }
- if (loadBalancer instanceof ServiceFilterAware) {
- ((ServiceFilterAware)
loadBalancer).setServiceFilter(serviceFilter);
- }
- if (loadBalancer instanceof ServiceChooserAware) {
- ((ServiceChooserAware)
loadBalancer).setServiceChooser(serviceChooser);
- }
-
- // The component is used to configure the default scheme to use (eg
camel component name).
- // The component configured on EIP takes precedence vs configured on
configuration.
- String endpointScheme = definition.getComponent();
- if (endpointScheme == null) {
- ServiceCallConfigurationDefinition conf =
retrieveConfig(camelContext);
- if (conf != null) {
- endpointScheme = conf.getComponent();
- }
- }
- if (endpointScheme == null) {
- ServiceCallConfigurationDefinition conf =
retrieveDefaultConfig(camelContext);
- if (conf != null) {
- endpointScheme = conf.getComponent();
- }
- }
-
- // The uri is used to tweak the uri.
- // The uri configured on EIP takes precedence vs configured on
configuration.
- String endpointUri = definition.getUri();
- if (endpointUri == null) {
- ServiceCallConfigurationDefinition conf =
retrieveConfig(camelContext);
- if (conf != null) {
- endpointUri = conf.getUri();
- }
- }
- if (endpointUri == null) {
- ServiceCallConfigurationDefinition conf =
retrieveDefaultConfig(camelContext);
- if (conf != null) {
- endpointUri = conf.getUri();
- }
- }
-
- // Service name is mandatory
- ObjectHelper.notNull(definition.getName(), "Service name");
-
- endpointScheme = ThrowingHelper.applyIfNotEmpty(endpointScheme,
camelContext::resolvePropertyPlaceholders, () ->
ServiceCallDefinitionConstants.DEFAULT_COMPONENT);
- endpointUri = ThrowingHelper.applyIfNotEmpty(endpointUri,
camelContext::resolvePropertyPlaceholders, () -> null);
-
- return new DefaultServiceCallProcessor(
- camelContext,
- camelContext.resolvePropertyPlaceholders(definition.getName()),
- endpointScheme,
- endpointUri,
- definition.getPattern(),
- loadBalancer,
- retrieveExpression(camelContext, endpointScheme));
- }
-
- // *****************************
- // Helpers
- // *****************************
-
- private ServiceCallConfigurationDefinition
retrieveDefaultConfig(CamelContext camelContext) {
- // check if a default configuration is bound to the registry
- ServiceCallConfigurationDefinition config =
camelContext.adapt(ModelCamelContext.class).getServiceCallConfiguration(null);
-
- if (config == null) {
- // Or if it is in the registry
- config = lookup(
- camelContext,
-
ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_CONFIG_ID,
- ServiceCallConfigurationDefinition.class);
- }
-
- if (config == null) {
- // If no default is set either by searching by name or bound to the
- // camel context, assume that if there is a single instance in the
- // registry, that is the default one
- config = findByType(camelContext,
ServiceCallConfigurationDefinition.class);
- }
-
- return config;
- }
-
- private ServiceCallConfigurationDefinition retrieveConfig(CamelContext
camelContext) {
- ServiceCallConfigurationDefinition config = null;
- if (definition.getConfigurationRef() != null) {
- // lookup in registry firstNotNull
- config = lookup(camelContext, definition.getConfigurationRef(),
ServiceCallConfigurationDefinition.class);
- if (config == null) {
- // and fallback as service configuration
- config =
camelContext.adapt(ModelCamelContext.class).getServiceCallConfiguration(definition.getConfigurationRef());
- }
- }
-
- return config;
- }
-
- // ******************************************
- // ServiceDiscovery
- // ******************************************
-
- private ServiceDiscovery retrieveServiceDiscovery(CamelContext
camelContext, Function<CamelContext, ServiceCallConfigurationDefinition>
function) throws Exception {
- ServiceDiscovery answer = null;
-
- ServiceCallConfigurationDefinition config =
function.apply(camelContext);
- if (config != null) {
- if (config.getServiceDiscoveryConfiguration() != null) {
- answer =
config.getServiceDiscoveryConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- ServiceDiscovery.class,
- camelContext,
- config::getServiceDiscovery,
- config::getServiceDiscoveryRef
- );
- }
- }
-
- return answer;
- }
-
- private ServiceDiscovery retrieveServiceDiscovery(CamelContext
camelContext) throws Exception {
- return Suppliers.firstNotNull(
- () -> (definition.getServiceDiscoveryConfiguration() != null) ?
definition.getServiceDiscoveryConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceDiscovery.class, camelContext,
definition::getServiceDiscovery, definition::getServiceDiscoveryRef),
- // Linked configuration
- () -> retrieveServiceDiscovery(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceDiscovery(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceDiscovery.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_DISCOVERY_ID,
ServiceDiscovery.class)
- ).orElseGet(
- // Default, that's s little ugly but a load balancer may live
without
- // (i.e. the Ribbon one) so let's delegate the null check to the
actual
- // impl.
- () -> null
- );
- }
-
- // ******************************************
- // ServiceFilter
- // ******************************************
-
- private ServiceFilter retrieveServiceFilter(CamelContext camelContext,
Function<CamelContext, ServiceCallConfigurationDefinition> function) throws
Exception {
- ServiceFilter answer = null;
-
- ServiceCallConfigurationDefinition config =
function.apply(camelContext);
- if (config != null) {
- if (config.getServiceFilterConfiguration() != null) {
- answer =
config.getServiceFilterConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- ServiceFilter.class,
- camelContext,
- config::getServiceFilter,
- config::getServiceFilterRef
- );
- }
-
- if (answer == null) {
- String ref = config.getServiceFilterRef();
- if (ObjectHelper.equal("healthy", ref, true)) {
- answer = new HealthyServiceFilter();
- } else if (ObjectHelper.equal("pass-through", ref, true)) {
- answer = new PassThroughServiceFilter();
- } else if (ObjectHelper.equal("passthrough", ref, true)) {
- answer = new PassThroughServiceFilter();
- }
- }
- }
-
- return answer;
- }
-
- private ServiceFilter retrieveServiceFilter(CamelContext camelContext)
throws Exception {
- return Suppliers.firstNotNull(
- () -> (definition.getServiceFilterConfiguration() != null) ?
definition.getServiceFilterConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceFilter.class, camelContext,
definition::getServiceFilter, definition::getServiceFilterRef),
- // Linked configuration
- () -> retrieveServiceFilter(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceFilter(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceFilter.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class)
- ).orElseGet(
- // Default
- () -> new HealthyServiceFilter()
- );
- }
-
- // ******************************************
- // ServiceChooser
- // ******************************************
-
- private ServiceChooser retrieveServiceChooser(CamelContext camelContext,
Function<CamelContext, ServiceCallConfigurationDefinition> function) throws
Exception {
- ServiceChooser answer = null;
-
- ServiceCallConfigurationDefinition config =
function.apply(camelContext);
- if (config != null) {
- answer = retrieve(
- ServiceChooser.class,
- camelContext,
- config::getServiceChooser,
- config::getServiceChooserRef
- );
-
- if (answer == null) {
- String ref = config.getServiceChooserRef();
- if (ObjectHelper.equal("roundrobin", ref, true)) {
- answer = new RoundRobinServiceChooser();
- } else if (ObjectHelper.equal("round-robin", ref, true)) {
- answer = new RoundRobinServiceChooser();
- } else if (ObjectHelper.equal("random", ref, true)) {
- answer = new RandomServiceChooser();
- }
- }
- }
-
- return answer;
- }
-
- private ServiceChooser retrieveServiceChooser(CamelContext camelContext)
throws Exception {
- return Suppliers.firstNotNull(
- // Local configuration
- () -> retrieve(ServiceChooser.class, camelContext,
definition::getServiceChooser, definition::getServiceChooserRef),
- // Linked configuration
- () -> retrieveServiceChooser(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceChooser(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceChooser.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class)
- ).orElseGet(
- // Default
- () -> new RoundRobinServiceChooser()
- );
- }
-
- // ******************************************
- // LoadBalancer
- // ******************************************
-
- private ServiceLoadBalancer retrieveLoadBalancer(CamelContext
camelContext, Function<CamelContext, ServiceCallConfigurationDefinition>
function) throws Exception {
- ServiceLoadBalancer answer = null;
-
- ServiceCallConfigurationDefinition config =
function.apply(camelContext);
- if (config != null) {
- if (config.getLoadBalancerConfiguration() != null) {
- answer =
config.getLoadBalancerConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- ServiceLoadBalancer.class,
- camelContext,
- config::getLoadBalancer,
- config::getLoadBalancerRef
- );
- }
- }
-
- return answer;
- }
-
- private ServiceLoadBalancer retrieveLoadBalancer(CamelContext
camelContext) throws Exception {
- return Suppliers.firstNotNull(
- () -> (definition.getLoadBalancerConfiguration() != null) ?
definition.getLoadBalancerConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceLoadBalancer.class, camelContext,
definition::getLoadBalancer, definition::getLoadBalancerRef),
- // Linked configuration
- () -> retrieveLoadBalancer(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveLoadBalancer(camelContext,
this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceLoadBalancer.class),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_LOAD_BALANCER_ID,
ServiceLoadBalancer.class)
- ).orElseGet(
- // Default
- () -> new DefaultServiceLoadBalancer()
- );
- }
-
- // ******************************************
- // Expression
- // ******************************************
-
- private Expression retrieveExpression(CamelContext camelContext,
Function<CamelContext, ServiceCallConfigurationDefinition> function) throws
Exception {
- Expression answer = null;
-
- ServiceCallConfigurationDefinition config =
function.apply(camelContext);
- if (config != null) {
- if (config.getExpressionConfiguration() != null) {
- answer =
config.getExpressionConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- Expression.class,
- camelContext,
- config::getExpression,
- config::getExpressionRef
- );
- }
- }
-
- return answer;
- }
-
- private Expression retrieveExpression(CamelContext camelContext, String
component) throws Exception {
- Optional<Expression> expression = Suppliers.firstNotNull(
- () -> (definition.getExpressionConfiguration() != null) ?
definition.getExpressionConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(Expression.class, camelContext,
definition::getExpression, definition::getExpressionRef),
- // Linked configuration
- () -> retrieveExpression(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveExpression(camelContext,
this::retrieveDefaultConfig),
- // From registry
- () -> lookup(camelContext,
ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID,
Expression.class)
- );
-
- if (expression.isPresent()) {
- return expression.get();
- } else {
- String lookupName = component + "-service-expression";
- // First try to find the factory from the registry.
- ServiceExpressionFactory factory =
CamelContextHelper.lookup(camelContext, lookupName,
ServiceExpressionFactory.class);
- if (factory != null) {
- // If a factory is found in the registry do not re-configure
it as
- // it should be pre-configured.
- return factory.newInstance(camelContext);
- } else {
-
- Class<?> type = null;
-
- try {
- // Then use Service factory.
- type =
camelContext.getFactoryFinder(ServiceCallDefinitionConstants.RESOURCE_PATH).findClass(lookupName);
- } catch (Exception e) {
- }
-
- if (ObjectHelper.isNotEmpty(type)) {
- if (ServiceExpressionFactory.class.isAssignableFrom(type))
{
- factory = (ServiceExpressionFactory)
camelContext.getInjector().newInstance(type);
- } else {
- throw new IllegalArgumentException(
- "Resolving Expression: " + lookupName + "
detected type conflict: Not a ServiceExpressionFactory implementation. Found: "
+ type.getName());
- }
- } else {
- // If no factory is found, returns the default
- factory = context -> new DefaultServiceCallExpression();
- }
-
- return factory.newInstance(camelContext);
- }
- }
- }
-
- // ************************************
- // Helpers
- // ************************************
-
- private <T> T retrieve(Class<T> type, CamelContext camelContext,
Supplier<T> instanceSupplier, Supplier<String> refSupplier) {
- T answer = null;
- if (instanceSupplier != null) {
- answer = instanceSupplier.get();
- }
-
- if (answer == null && refSupplier != null) {
- String ref = refSupplier.get();
- if (ref != null) {
- answer = lookup(camelContext, ref, type);
- }
- }
-
- return answer;
+ throw new IllegalStateException("Cannot find camel-cloud on the
classpath.");
}
}
diff --git
a/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
b/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
index 23b9aa3..6f97c5a 100644
---
a/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.processor;
+import java.util.Map;
+
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.NamedNode;
@@ -83,10 +85,12 @@ public class CustomProcessorFactoryTest extends
ContextTestSupport {
// START SNIPPET: e3
public static class MyFactory implements ProcessorFactory {
+ @Override
public Processor createChildProcessor(RouteContext routeContext,
NamedNode definition, boolean mandatory) throws Exception {
return null;
}
+ @Override
public Processor createProcessor(RouteContext routeContext, NamedNode
definition) throws Exception {
if (definition instanceof SplitDefinition) {
// add additional output to the splitter
@@ -103,6 +107,11 @@ public class CustomProcessorFactoryTest extends
ContextTestSupport {
// before the processor was created
return null;
}
+
+ @Override
+ public Processor createProcessor(CamelContext camelContext, String
definitionName, Map<String, Object> args) throws Exception {
+ return null;
+ }
}
// END SNIPPET: e3
diff --git a/core/pom.xml b/core/pom.xml
index a8fbeb3..539c51c 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -46,6 +46,7 @@
<module>camel-core</module>
<module>camel-core-osgi</module>
<module>camel-core-xml</module>
+ <module>camel-cloud</module>
</modules>
<build>
diff --git
a/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-linux.sh
b/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-linux.sh
index 9e0e355..58e8b56 100755
---
a/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-linux.sh
+++
b/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-linux.sh
@@ -17,7 +17,7 @@
#
-CONSUL_VER="1.0.6"
+CONSUL_VER="1.0.8"
CONSUL_ZIP="consul_${CONSUL_VER}_linux_amd64.zip"
# cleanup
diff --git
a/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-osx.sh
b/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-osx.sh
index 1f2ccb2..a4241c6 100755
---
a/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-osx.sh
+++
b/examples/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-osx.sh
@@ -17,7 +17,7 @@
#
-CONSUL_VER="1.0.6"
+CONSUL_VER="1.0.8"
CONSUL_ZIP="consul_${CONSUL_VER}_darwin_amd64.zip"
# cleanup
diff --git
a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh
b/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh
index 4f43062..d985817 100755
---
a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh
+++
b/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-linux.sh
@@ -17,7 +17,7 @@
#
-CONSUL_VER="1.0.0"
+CONSUL_VER="1.0.8"
CONSUL_ZIP="consul_${CONSUL_VER}_linux_amd64.zip"
# cleanup
diff --git
a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh
b/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh
index 4de8b18..8a9b31d 100755
---
a/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh
+++
b/examples/camel-example-spring-boot-servicecall/services/src/main/bash/consul-run-osx.sh
@@ -17,7 +17,7 @@
#
-CONSUL_VER="1.0.6"
+CONSUL_VER="1.0.8"
CONSUL_ZIP="consul_${CONSUL_VER}_darwin_amd64.zip"
# cleanup
diff --git a/examples/camel-example-spring-cloud-servicecall/README.adoc
b/examples/camel-example-spring-cloud-servicecall/README.adoc
index 3e66d3b..43704a0 100644
--- a/examples/camel-example-spring-cloud-servicecall/README.adoc
+++ b/examples/camel-example-spring-cloud-servicecall/README.adoc
@@ -23,7 +23,7 @@ Using multiple shells:
- start consul:
- $ cd services
+ $ cd service
$ src/main/bash/consul-run-linux.sh (for linux)
$ src/main/bash/consul-run-osx.sh (for mac osx)
diff --git
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
index 711972f..f5f5de2 100755
---
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
+++
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh
@@ -17,7 +17,7 @@
#
-CONSUL_VER="1.0.6"
+CONSUL_VER="1.0.8"
CONSUL_ZIP="consul_${CONSUL_VER}_linux_amd64.zip"
# cleanup
diff --git
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
index feacbd9..85a0007 100755
---
a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
+++
b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh
@@ -17,7 +17,7 @@
#
-CONSUL_VER="1.0.6"
+CONSUL_VER="1.0.8"
CONSUL_ZIP="consul_${CONSUL_VER}_darwin_amd64.zip"
# cleanup
diff --git a/parent/pom.xml b/parent/pom.xml
index b3e5d41..4068451 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -827,6 +827,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-headersmap</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/platforms/karaf/features/src/main/resources/features.xml
b/platforms/karaf/features/src/main/resources/features.xml
index 205442d..a5bbad4 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -17,7 +17,7 @@
limitations under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0"
name='camel-${project.version}'>
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0"
name='camel-${project.version}'>
<repository>mvn:org.apache.cxf.karaf/apache-cxf/${cxf-version}/xml/features</repository>
<repository>mvn:org.apache.jclouds.karaf/jclouds-karaf/${jclouds-version}/xml/features</repository>
<repository>mvn:org.ops4j.pax.cdi/pax-cdi-features/${pax-cdi-version}/xml/features</repository>
@@ -52,6 +52,7 @@
<bundle>mvn:org.apache.camel/camel-management-impl/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-core/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-core-osgi/${project.version}</bundle>
+ <bundle>mvn:org.apache.camel/camel-cloud/${project.version}</bundle>
<!-- core components -->
<bundle>mvn:org.apache.camel/camel-browse/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-controlbus/${project.version}</bundle>
diff --git
a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 138fdd9..2a6ab61 100644
---
a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++
b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -763,6 +763,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-cm-sms</artifactId>
<version>${project.version}</version>
</dependency>