camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lburgazz...@apache.org
Subject [2/2] camel git commit: Move cloud core feautres to camel-spring-boot
Date Mon, 20 Mar 2017 13:08:06 GMT
Move cloud core feautres to camel-spring-boot


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/61e50869
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/61e50869
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/61e50869

Branch: refs/heads/master
Commit: 61e50869e27b5ac4c7a08b9d3fa3175949eb25d0
Parents: 1735a5b
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Mon Mar 20 14:06:53 2017 +0100
Committer: lburgazzoli <lburgazzoli@gmail.com>
Committed: Mon Mar 20 14:07:29 2017 +0100

----------------------------------------------------------------------
 components/camel-spring-boot/pom.xml            |   5 +
 .../boot/cloud/CamelCloudAutoConfiguration.java |  30 +++++
 .../CamelCloudConfigurationProperties.java      | 127 +++++++++++++++++++
 ...melCloudServiceChooserAutoConfiguration.java |  43 +++++++
 .../boot/cloud/CamelCloudServiceDiscovery.java  |  47 +++++++
 ...lCloudServiceDiscoveryAutoConfiguration.java |  79 ++++++++++++
 .../boot/cloud/CamelCloudServiceFilter.java     |  36 ++++++
 ...amelCloudServiceFilterAutoConfiguration.java |  70 ++++++++++
 .../main/resources/META-INF/spring.factories    |   4 +
 .../CamelCloudServiceCallConfigurationTest.java |  76 +++++++++++
 .../boot/cloud/CamelCloudServiceCallTest.java   |  89 +++++++++++++
 .../cloud/CamelCloudAutoConfiguration.java      |  30 -----
 .../CamelCloudConfigurationProperties.java      | 127 -------------------
 .../spring/cloud/CamelCloudDiscoveryClient.java |  70 ----------
 .../spring/cloud/CamelCloudLoadBalancer.java    |  85 -------------
 ...CamelCloudLoadBalancerAutoConfiguration.java |  60 ---------
 ...melCloudServiceChooserAutoConfiguration.java |  44 -------
 .../cloud/CamelCloudServiceDiscovery.java       |  47 -------
 ...lCloudServiceDiscoveryAutoConfiguration.java |  79 ------------
 .../spring/cloud/CamelCloudServiceFilter.java   |  36 ------
 ...amelCloudServiceFilterAutoConfiguration.java |  70 ----------
 .../cloud/CamelSpringCloudDiscoveryClient.java  |  65 ++++++++++
 .../cloud/CamelSpringCloudLoadBalancer.java     |  82 ++++++++++++
 ...pringCloudLoadBalancerAutoConfiguration.java |  64 ++++++++++
 .../main/resources/META-INF/spring.factories    |   6 +-
 .../CamelCloudServiceCallConfigurationTest.java |  76 -----------
 .../cloud/CamelCloudServiceCallRibbonTest.java  |  57 ---------
 ...CloudServiceCallRoutesAutoConfiguration.java |  47 -------
 .../spring/cloud/CamelCloudServiceCallTest.java |  58 ---------
 .../CamelSpringCloudServiceCallRibbonTest.java  |  90 +++++++++++++
 30 files changed, 908 insertions(+), 891 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml
index f17f90f..50cc2a4 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -104,6 +104,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-http</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-netty4-http</artifactId>
       <scope>test</scope>
     </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudAutoConfiguration.java
new file mode 100644
index 0000000..f565769
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudAutoConfiguration.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConditionalOnBean(CamelAutoConfiguration.class)
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+@ConditionalOnProperty(value = "camel.cloud.enabled", matchIfMissing = true)
+public class CamelCloudAutoConfiguration {
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
new file mode 100644
index 0000000..6152547
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
@@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties(prefix = "camel.cloud")
+public class CamelCloudConfigurationProperties {
+    private boolean enabled = true;
+    private LoadBalancer loadBalancer = new LoadBalancer();
+    private ServiceDiscovery serviceDiscovery = new ServiceDiscovery();
+    private ServiceFilter serviceFilter = new ServiceFilter();
+    private ServiceChooser serviceChooser = new ServiceChooser();
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public LoadBalancer getLoadBalancer() {
+        return loadBalancer;
+    }
+
+    public ServiceDiscovery getServiceDiscovery() {
+        return serviceDiscovery;
+    }
+
+    public ServiceFilter getServiceFilter() {
+        return serviceFilter;
+    }
+
+    public ServiceChooser getServiceChooser() {
+        return serviceChooser;
+    }
+
+    // *****************************************
+    // Nested configurations
+    // *****************************************
+
+    public static class LoadBalancer {
+        private boolean enabled = true;
+
+        public boolean isEnabled() {
+            return enabled;
+        }
+
+        public void setEnabled(boolean enabled) {
+            this.enabled = enabled;
+        }
+    }
+
+    public static class ServiceDiscovery {
+        private boolean enabled = true;
+        private Map<String, List<String>> services = new HashMap<>();
+        private String cacheTimeout;
+
+        public boolean isEnabled() {
+            return enabled;
+        }
+
+        public void setEnabled(boolean enabled) {
+            this.enabled = enabled;
+        }
+
+        public Map<String, List<String>> getServices() {
+            return services;
+        }
+
+        public String getCacheTimeout() {
+            return cacheTimeout;
+        }
+
+        public void setCacheTimeout(String cacheTimeout) {
+            this.cacheTimeout = cacheTimeout;
+        }
+    }
+
+    public static class ServiceFilter {
+        private boolean enabled = true;
+        private Map<String, List<String>> blacklist = new HashMap<>();
+
+        public boolean isEnabled() {
+            return enabled;
+        }
+
+        public void setEnabled(boolean enabled) {
+            this.enabled = enabled;
+        }
+
+        public Map<String, List<String>> getBlacklist() {
+            return blacklist;
+        }
+    }
+
+    public static class ServiceChooser {
+        private boolean enabled = true;
+
+        public boolean isEnabled() {
+            return enabled;
+        }
+
+        public void setEnabled(boolean enabled) {
+            this.enabled = enabled;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceChooserAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceChooserAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceChooserAutoConfiguration.java
new file mode 100644
index 0000000..7214eb3
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceChooserAutoConfiguration.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConditionalOnBean(CamelCloudAutoConfiguration.class)
+@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
+@Conditional(CamelCloudServiceChooserAutoConfiguration.ServiceChooserCondition.class)
+public class CamelCloudServiceChooserAutoConfiguration {
+
+    // *******************************
+    // Condition
+    // *******************************
+
+    public static class ServiceChooserCondition extends GroupCondition {
+        public ServiceChooserCondition() {
+            super(
+                "camel.cloud",
+                "camel.cloud.service-chooser"
+            );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java
new file mode 100644
index 0000000..6428b63
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.cloud.ServiceDiscovery;
+import org.apache.camel.impl.cloud.CachingServiceDiscovery;
+import org.apache.camel.impl.cloud.ChainedServiceDiscovery;
+
+public class CamelCloudServiceDiscovery implements ServiceDiscovery {
+    private ServiceDiscovery delegate;
+
+    public CamelCloudServiceDiscovery(Long timeout, List<ServiceDiscovery> serviceDiscoveryList) {
+        // Created a chained service discovery that collects services from multiple
+        // ServiceDiscovery
+        this.delegate = new ChainedServiceDiscovery(serviceDiscoveryList);
+
+        // If a timeout is provided, wrap the serviceDiscovery with a caching
+        // strategy so the discovery implementations are not queried for each
+        // discovery request
+        if (timeout != null && timeout > 0) {
+            this.delegate = CachingServiceDiscovery.wrap(this.delegate, timeout, TimeUnit.MILLISECONDS);
+        }
+    }
+
+    @Override
+    public List<ServiceDefinition> getServices(String name) {
+        return delegate.getServices(name);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
new file mode 100644
index 0000000..9595063
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.boot.cloud;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.cloud.ServiceDiscovery;
+import org.apache.camel.impl.cloud.StaticServiceDiscovery;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+@Configuration
+@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
+@Conditional(CamelCloudServiceDiscoveryAutoConfiguration.Condition.class)
+public class CamelCloudServiceDiscoveryAutoConfiguration {
+
+    @Lazy
+    @Bean(name = "static-service-discovery")
+    public ServiceDiscovery staticServiceDiscovery(CamelCloudConfigurationProperties properties) {
+        StaticServiceDiscovery staticServiceDiscovery = new StaticServiceDiscovery();
+
+        Map<String, List<String>> services = properties.getServiceDiscovery().getServices();
+        for (Map.Entry<String, List<String>> entry : services.entrySet()) {
+            staticServiceDiscovery.addServers(entry.getKey(), entry.getValue());
+        }
+
+        return staticServiceDiscovery;
+    }
+
+    @Lazy
+    @Bean(name = "service-discovery")
+    public CamelCloudServiceDiscovery serviceDiscovery(
+            CamelContext camelContext, CamelCloudConfigurationProperties properties, List<ServiceDiscovery> serviceDiscoveryList) throws NoTypeConversionAvailableException {
+
+        String cacheTimeout = properties.getServiceDiscovery().getCacheTimeout();
+        Long timeout = null;
+
+        if (cacheTimeout != null) {
+            timeout = camelContext.getTypeConverter().mandatoryConvertTo(Long.class, timeout);
+        }
+
+        return new CamelCloudServiceDiscovery(timeout, serviceDiscoveryList);
+    }
+
+    // *******************************
+    // Condition
+    // *******************************
+
+    public static class Condition extends GroupCondition {
+        public Condition() {
+            super(
+                "camel.cloud",
+                "camel.cloud.service-discovery"
+            );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilter.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilter.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilter.java
new file mode 100644
index 0000000..3f8928b
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilter.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import java.util.List;
+
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.cloud.ServiceFilter;
+import org.apache.camel.impl.cloud.ChainedServiceFilter;
+
+public class CamelCloudServiceFilter implements ServiceFilter {
+    private final ChainedServiceFilter serviceFilter;
+
+    public CamelCloudServiceFilter(List<ServiceFilter> blacklistServiceFilter) {
+        this.serviceFilter = new ChainedServiceFilter(blacklistServiceFilter);
+    }
+
+    @Override
+    public List<ServiceDefinition> apply(List<ServiceDefinition> serviceDefinitions) {
+        return  this.serviceFilter.apply(serviceDefinitions);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilterAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilterAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilterAutoConfiguration.java
new file mode 100644
index 0000000..5a23d35
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceFilterAutoConfiguration.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.cloud;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.impl.cloud.BlacklistServiceFilter;
+import org.apache.camel.impl.cloud.HealthyServiceFilter;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.StringHelper;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+@Configuration
+@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
+@Conditional(CamelCloudServiceFilterAutoConfiguration.Condition.class)
+public class CamelCloudServiceFilterAutoConfiguration {
+    @Lazy
+    @Bean(name = "service-filter")
+    public CamelCloudServiceFilter serviceFilter(CamelCloudConfigurationProperties properties) {
+        BlacklistServiceFilter blacklist = new BlacklistServiceFilter();
+
+        Map<String, List<String>> services = properties.getServiceFilter().getBlacklist();
+        for (Map.Entry<String, List<String>> entry : services.entrySet()) {
+            for (String part : entry.getValue()) {
+                String host = StringHelper.before(part, ":");
+                String port = StringHelper.after(part, ":");
+
+                if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) {
+                    blacklist.addServer(entry.getKey(), host, Integer.parseInt(port));
+                }
+            }
+        }
+
+        return new CamelCloudServiceFilter(Arrays.asList(new HealthyServiceFilter(), blacklist));
+    }
+
+    // *******************************
+    // Condition
+    // *******************************
+
+    public static class Condition extends GroupCondition {
+        public Condition() {
+            super(
+                "camel.cloud",
+                "camel.cloud.service-filter"
+            );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/resources/META-INF/spring.factories b/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
index 361ef6b..d7ae56e 100644
--- a/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
+++ b/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
@@ -18,4 +18,8 @@
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
 org.apache.camel.spring.boot.CamelAutoConfiguration,\
 org.apache.camel.spring.boot.CamelRestAutoConfiguration,\
+org.apache.camel.spring.boot.cloud.CamelCloudAutoConfiguration,\
+org.apache.camel.spring.boot.cloud.CamelCloudServiceDiscoveryAutoConfiguration,\
+org.apache.camel.spring.boot.cloud.CamelCloudServiceFilterAutoConfiguration,\
+org.apache.camel.spring.boot.cloud.CamelCloudServiceChooserAutoConfiguration,\
 org.apache.camel.spring.boot.health.CamelHealthAutoConfiguration

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationTest.java
new file mode 100644
index 0000000..4ee24c5
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallConfigurationTest.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.boot.cloud;
+
+import org.apache.camel.cloud.LoadBalancer;
+import org.apache.camel.cloud.ServiceChooser;
+import org.apache.camel.cloud.ServiceDiscovery;
+import org.apache.camel.cloud.ServiceFilter;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.env.Environment;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@SpringBootApplication()
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        CamelCloudAutoConfiguration.class,
+        CamelCloudServiceChooserAutoConfiguration.class
+    },
+    properties = {
+        "camel.cloud.enabled=false",
+        "camel.cloud.service-discovery.enabled=false",
+        "camel.cloud.service-filter.enabled=false",
+        "camel.cloud.service-chooser.enabled=true",
+        "camel.cloud.load-balancer.enabled=false",
+        "debug=false"
+    }
+)
+public class CamelCloudServiceCallConfigurationTest {
+    @Autowired
+    private ApplicationContext ctx;
+
+    @Test
+    public void doTest() throws Exception {
+        Environment env = ctx.getEnvironment();
+
+        assertFalse(env.getProperty("camel.cloud.enabled", Boolean.class));
+        assertFalse(env.getProperty("camel.cloud.service-discovery.enabled", Boolean.class));
+        assertFalse(env.getProperty("camel.cloud.service-filter.enabled", Boolean.class));
+        assertTrue(env.getProperty("camel.cloud.service-chooser.enabled", Boolean.class));
+        assertFalse(env.getProperty("camel.cloud.load-balancer.enabled", Boolean.class));
+
+        assertTrue(ctx.getBeansOfType(ServiceDiscovery.class).isEmpty());
+        assertTrue(ctx.getBeansOfType(ServiceFilter.class).isEmpty());
+        assertTrue(ctx.getBeansOfType(ServiceChooser.class).isEmpty());
+        assertTrue(ctx.getBeansOfType(LoadBalancer.class).isEmpty());
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
new file mode 100644
index 0000000..f5a9735
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.boot.cloud;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        CamelCloudServiceCallTest.TestConfiguration.class
+    },
+    properties = {
+        "camel.cloud.load-balancer.enabled=false",
+        "camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
+        "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
+        "ribbon.enabled=false",
+        "debug=false"
+    }
+)
+public class CamelCloudServiceCallTest {
+    @Autowired
+    private ProducerTemplate template;
+
+    @Test
+    public void testServiceCall() throws Exception {
+        Assert.assertEquals("9090", template.requestBody("direct:start", null, String.class));
+        Assert.assertEquals("9092", template.requestBody("direct:start", null, String.class));
+    }
+
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+        @Bean
+        public RouteBuilder myRouteBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() throws Exception {
+                    from("direct:start")
+                        .serviceCall()
+                        .name("custom-svc-list/hello");
+
+                    from("netty4-http:http://localhost:9090/hello")
+                        .transform()
+                        .constant("9090");
+                    from("netty4-http:http://localhost:9091/hello")
+                        .transform()
+                        .constant("9091");
+                    from("netty4-http:http://localhost:9092/hello")
+                        .transform()
+                        .constant("9092");
+                }
+            };
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudAutoConfiguration.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudAutoConfiguration.java
deleted file mode 100644
index 0948436..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudAutoConfiguration.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.spring.cloud;
-
-import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConditionalOnBean(CamelAutoConfiguration.class)
-@AutoConfigureAfter(CamelAutoConfiguration.class)
-@ConditionalOnProperty(value = "camel.cloud.enabled", matchIfMissing = true)
-public class CamelCloudAutoConfiguration {
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudConfigurationProperties.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudConfigurationProperties.java
deleted file mode 100644
index 97c1234..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudConfigurationProperties.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.spring.cloud;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "camel.cloud")
-public class CamelCloudConfigurationProperties {
-    private boolean enabled = true;
-    private LoadBalancer loadBalancer = new LoadBalancer();
-    private ServiceDiscovery serviceDiscovery = new ServiceDiscovery();
-    private ServiceFilter serviceFilter = new ServiceFilter();
-    private ServiceChooser serviceChooser = new ServiceChooser();
-
-    public boolean isEnabled() {
-        return enabled;
-    }
-
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
-    }
-
-    public LoadBalancer getLoadBalancer() {
-        return loadBalancer;
-    }
-
-    public ServiceDiscovery getServiceDiscovery() {
-        return serviceDiscovery;
-    }
-
-    public ServiceFilter getServiceFilter() {
-        return serviceFilter;
-    }
-
-    public ServiceChooser getServiceChooser() {
-        return serviceChooser;
-    }
-
-    // *****************************************
-    // Nested configurations
-    // *****************************************
-
-    public static class LoadBalancer {
-        private boolean enabled = true;
-
-        public boolean isEnabled() {
-            return enabled;
-        }
-
-        public void setEnabled(boolean enabled) {
-            this.enabled = enabled;
-        }
-    }
-
-    public static class ServiceDiscovery {
-        private boolean enabled = true;
-        private Map<String, List<String>> services = new HashMap<>();
-        private String cacheTimeout;
-
-        public boolean isEnabled() {
-            return enabled;
-        }
-
-        public void setEnabled(boolean enabled) {
-            this.enabled = enabled;
-        }
-
-        public Map<String, List<String>> getServices() {
-            return services;
-        }
-
-        public String getCacheTimeout() {
-            return cacheTimeout;
-        }
-
-        public void setCacheTimeout(String cacheTimeout) {
-            this.cacheTimeout = cacheTimeout;
-        }
-    }
-
-    public static class ServiceFilter {
-        private boolean enabled = true;
-        private Map<String, List<String>> blacklist = new HashMap<>();
-
-        public boolean isEnabled() {
-            return enabled;
-        }
-
-        public void setEnabled(boolean enabled) {
-            this.enabled = enabled;
-        }
-
-        public Map<String, List<String>> getBlacklist() {
-            return blacklist;
-        }
-    }
-
-    public static class ServiceChooser {
-        private boolean enabled = true;
-
-        public boolean isEnabled() {
-            return enabled;
-        }
-
-        public void setEnabled(boolean enabled) {
-            this.enabled = enabled;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
deleted file mode 100644
index 4f0b4f5..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.spring.cloud;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.apache.camel.cloud.ServiceDiscovery;
-import org.springframework.cloud.client.DefaultServiceInstance;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.client.discovery.DiscoveryClient;
-
-public class CamelCloudDiscoveryClient implements DiscoveryClient {
-    private final String description;
-    private final ServiceDiscovery serviceDiscovery;
-    private ServiceInstance localInstance;
-
-    public CamelCloudDiscoveryClient(String description, ServiceDiscovery serviceDiscovery) {
-        this(description, null, serviceDiscovery);
-    }
-
-    public CamelCloudDiscoveryClient(String description, ServiceInstance localServiceDiscovery, ServiceDiscovery serviceDiscovery) {
-        this.description = description;
-        this.serviceDiscovery = serviceDiscovery;
-        this.localInstance = localServiceDiscovery;
-    }
-
-    @Override
-    public String description() {
-        return description;
-    }
-
-    @Override
-    public ServiceInstance getLocalServiceInstance() {
-        return this.localInstance;
-    }
-
-    public CamelCloudDiscoveryClient setLocalServiceInstance(ServiceInstance instance) {
-        this.localInstance = instance;
-        return this;
-    }
-
-    @Override
-    public List<ServiceInstance> getInstances(String serviceId) {
-        return serviceDiscovery.getServices(serviceId).stream()
-            .map(s -> new DefaultServiceInstance(s.getName(), s.getHost(), s.getPort(), false, s.getMetadata()))
-            .collect(Collectors.toList());
-    }
-
-    @Override
-    public List<String> getServices() {
-        return Collections.emptyList();
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancer.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancer.java
deleted file mode 100644
index c37a1eea..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancer.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.spring.cloud;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.cloud.LoadBalancer;
-import org.apache.camel.cloud.LoadBalancerFunction;
-import org.apache.camel.cloud.ServiceDefinition;
-import org.apache.camel.impl.cloud.DefaultServiceDefinition;
-import org.apache.camel.support.ServiceSupport;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
-
-public class CamelCloudLoadBalancer extends ServiceSupport implements CamelContextAware, LoadBalancer {
-    private static final Logger LOGGER = LoggerFactory.getLogger(CamelCloudLoadBalancer.class);
-
-    private final LoadBalancerClient loadBalancerClient;
-    private CamelContext camelContext;
-
-    public CamelCloudLoadBalancer(LoadBalancerClient loadBalancerClient) {
-        this.loadBalancerClient = loadBalancerClient;
-    }
-
-    @Override
-    public CamelContext getCamelContext() {
-        return camelContext;
-    }
-
-    @Override
-    public void setCamelContext(CamelContext camelContext) {
-        this.camelContext = camelContext;
-    }
-
-    @Override
-    protected void doStart() throws Exception {
-        ObjectHelper.notNull(camelContext, "camelContext");
-        ObjectHelper.notNull(loadBalancerClient, "loadBalancerClient");
-
-        LOGGER.info("ServiceCall is using cloud load balancer of type: {}", loadBalancerClient.getClass());
-    }
-
-    @Override
-    protected void doStop() throws Exception {
-    }
-
-    @Override
-    public <T> T process(String serviceName, LoadBalancerFunction<T> function) throws Exception {
-
-
-        return loadBalancerClient.execute(
-            serviceName,  i -> function.apply(instanceToDefinition(i)));
-    }
-
-    // *******************************
-    // Helpers
-    // *******************************
-
-    private ServiceDefinition instanceToDefinition(ServiceInstance instance) {
-        return new DefaultServiceDefinition(
-            instance.getServiceId(),
-            instance.getHost(),
-            instance.getPort(),
-            instance.getMetadata()
-        );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancerAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancerAutoConfiguration.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancerAutoConfiguration.java
deleted file mode 100644
index 479e5f3..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudLoadBalancerAutoConfiguration.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.spring.cloud;
-
-
-import org.apache.camel.cloud.LoadBalancer;
-import org.apache.camel.spring.boot.util.GroupCondition;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration;
-import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConditionalOnBean({ CamelCloudAutoConfiguration.class, LoadBalancerClient.class })
-@AutoConfigureAfter({ LoadBalancerAutoConfiguration.class, CamelCloudServiceDiscoveryAutoConfiguration.class })
-@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
-@Conditional(CamelCloudLoadBalancerAutoConfiguration.LoadBalancerCondition.class)
-public class CamelCloudLoadBalancerAutoConfiguration {
-    @Bean(name = "load-balancer")
-    public LoadBalancer cloudLoadBalancer(LoadBalancerClient loadBalancerClient) {
-        return new CamelCloudLoadBalancer(loadBalancerClient);
-    }
-
-    @Bean(name = "load-balancer-discovery-client")
-    public DiscoveryClient serviceDiscoveryClient(CamelCloudServiceDiscovery serviceDiscovery) {
-        return new CamelCloudDiscoveryClient("service-discovery-client", serviceDiscovery);
-    }
-
-    // *******************************
-    // Condition
-    // *******************************
-
-    public static class LoadBalancerCondition extends GroupCondition {
-        public LoadBalancerCondition() {
-            super(
-                "camel.cloud",
-                "camel.cloud.load-balancer"
-            );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceChooserAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceChooserAutoConfiguration.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceChooserAutoConfiguration.java
deleted file mode 100644
index 81838ef..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceChooserAutoConfiguration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.spring.cloud;
-
-import org.apache.camel.spring.boot.util.GroupCondition;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConditionalOnBean(CamelCloudAutoConfiguration.class)
-@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
-@Conditional(CamelCloudServiceChooserAutoConfiguration.ServiceChooserCondition.class)
-public class CamelCloudServiceChooserAutoConfiguration {
-
-    // *******************************
-    // Condition
-    // *******************************
-
-    public static class ServiceChooserCondition extends GroupCondition {
-        public ServiceChooserCondition() {
-            super(
-                "camel.cloud",
-                "camel.cloud.service-chooser"
-            );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
deleted file mode 100644
index d67963c..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.spring.cloud;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.cloud.ServiceDefinition;
-import org.apache.camel.cloud.ServiceDiscovery;
-import org.apache.camel.impl.cloud.CachingServiceDiscovery;
-import org.apache.camel.impl.cloud.ChainedServiceDiscovery;
-
-public class CamelCloudServiceDiscovery implements ServiceDiscovery {
-    private ServiceDiscovery delegate;
-
-    public CamelCloudServiceDiscovery(Long timeout, List<ServiceDiscovery> serviceDiscoveryList) {
-        // Created a chained service discovery that collects services from multiple
-        // ServiceDiscovery
-        this.delegate = new ChainedServiceDiscovery(serviceDiscoveryList);
-
-        // If a timeout is provided, wrap the serviceDiscovery with a caching
-        // strategy so the discovery implementations are not queried for each
-        // discovery request
-        if (timeout != null && timeout > 0) {
-            this.delegate = CachingServiceDiscovery.wrap(this.delegate, timeout, TimeUnit.MILLISECONDS);
-        }
-    }
-
-    @Override
-    public List<ServiceDefinition> getServices(String name) {
-        return delegate.getServices(name);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
deleted file mode 100644
index c0324b4..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.spring.cloud;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.NoTypeConversionAvailableException;
-import org.apache.camel.cloud.ServiceDiscovery;
-import org.apache.camel.impl.cloud.StaticServiceDiscovery;
-import org.apache.camel.spring.boot.util.GroupCondition;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-
-@Configuration
-@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
-@Conditional(CamelCloudServiceDiscoveryAutoConfiguration.Condition.class)
-public class CamelCloudServiceDiscoveryAutoConfiguration {
-
-    @Lazy
-    @Bean(name = "static-service-discovery")
-    public ServiceDiscovery staticServiceDiscovery(CamelCloudConfigurationProperties properties) {
-        StaticServiceDiscovery staticServiceDiscovery = new StaticServiceDiscovery();
-
-        Map<String, List<String>> services = properties.getServiceDiscovery().getServices();
-        for (Map.Entry<String, List<String>> entry : services.entrySet()) {
-            staticServiceDiscovery.addServers(entry.getKey(), entry.getValue());
-        }
-
-        return staticServiceDiscovery;
-    }
-
-    @Lazy
-    @Bean(name = "service-discovery")
-    public CamelCloudServiceDiscovery serviceDiscovery(
-            CamelContext camelContext, CamelCloudConfigurationProperties properties, List<ServiceDiscovery> serviceDiscoveryList) throws NoTypeConversionAvailableException {
-
-        String cacheTimeout = properties.getServiceDiscovery().getCacheTimeout();
-        Long timeout = null;
-
-        if (cacheTimeout != null) {
-            timeout = camelContext.getTypeConverter().mandatoryConvertTo(Long.class, timeout);
-        }
-
-        return new CamelCloudServiceDiscovery(timeout, serviceDiscoveryList);
-    }
-
-    // *******************************
-    // Condition
-    // *******************************
-
-    public static class Condition extends GroupCondition {
-        public Condition() {
-            super(
-                "camel.cloud",
-                "camel.cloud.service-discovery"
-            );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilter.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilter.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilter.java
deleted file mode 100644
index 5c5b8bf..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.spring.cloud;
-
-import java.util.List;
-
-import org.apache.camel.cloud.ServiceDefinition;
-import org.apache.camel.cloud.ServiceFilter;
-import org.apache.camel.impl.cloud.ChainedServiceFilter;
-
-public class CamelCloudServiceFilter implements ServiceFilter {
-    private final ChainedServiceFilter serviceFilter;
-
-    public CamelCloudServiceFilter(List<ServiceFilter> blacklistServiceFilter) {
-        this.serviceFilter = new ChainedServiceFilter(blacklistServiceFilter);
-    }
-
-    @Override
-    public List<ServiceDefinition> apply(List<ServiceDefinition> serviceDefinitions) {
-        return  this.serviceFilter.apply(serviceDefinitions);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilterAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilterAutoConfiguration.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilterAutoConfiguration.java
deleted file mode 100644
index c29e1a8..0000000
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceFilterAutoConfiguration.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.spring.cloud;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.camel.impl.cloud.BlacklistServiceFilter;
-import org.apache.camel.impl.cloud.HealthyServiceFilter;
-import org.apache.camel.spring.boot.util.GroupCondition;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.StringHelper;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-
-@Configuration
-@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
-@Conditional(CamelCloudServiceFilterAutoConfiguration.Condition.class)
-public class CamelCloudServiceFilterAutoConfiguration {
-    @Lazy
-    @Bean(name = "service-filter")
-    public CamelCloudServiceFilter serviceFilter(CamelCloudConfigurationProperties properties) {
-        BlacklistServiceFilter blacklist = new BlacklistServiceFilter();
-
-        Map<String, List<String>> services = properties.getServiceFilter().getBlacklist();
-        for (Map.Entry<String, List<String>> entry : services.entrySet()) {
-            for (String part : entry.getValue()) {
-                String host = StringHelper.before(part, ":");
-                String port = StringHelper.after(part, ":");
-
-                if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) {
-                    blacklist.addServer(entry.getKey(), host, Integer.parseInt(port));
-                }
-            }
-        }
-
-        return new CamelCloudServiceFilter(Arrays.asList(new HealthyServiceFilter(), blacklist));
-    }
-
-    // *******************************
-    // Condition
-    // *******************************
-
-    public static class Condition extends GroupCondition {
-        public Condition() {
-            super(
-                "camel.cloud",
-                "camel.cloud.service-filter"
-            );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudDiscoveryClient.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudDiscoveryClient.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudDiscoveryClient.java
new file mode 100644
index 0000000..b210ea4
--- /dev/null
+++ b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudDiscoveryClient.java
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.cloud;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.camel.cloud.ServiceDiscovery;
+import org.springframework.cloud.client.DefaultServiceInstance;
+import org.springframework.cloud.client.ServiceInstance;
+import org.springframework.cloud.client.discovery.DiscoveryClient;
+
+public class CamelSpringCloudDiscoveryClient implements DiscoveryClient {
+    private final String description;
+    private final ServiceDiscovery serviceDiscovery;
+    private ServiceInstance localInstance;
+
+    public CamelSpringCloudDiscoveryClient(String description, ServiceDiscovery serviceDiscovery) {
+        this(description, null, serviceDiscovery);
+    }
+
+    public CamelSpringCloudDiscoveryClient(String description, ServiceInstance localServiceDiscovery, ServiceDiscovery serviceDiscovery) {
+        this.description = description;
+        this.serviceDiscovery = serviceDiscovery;
+        this.localInstance = localServiceDiscovery;
+    }
+
+    @Override
+    public String description() {
+        return description;
+    }
+
+    @Override
+    public ServiceInstance getLocalServiceInstance() {
+        return this.localInstance;
+    }
+
+    @Override
+    public List<ServiceInstance> getInstances(String serviceId) {
+        return serviceDiscovery.getServices(serviceId).stream()
+            .map(s -> new DefaultServiceInstance(s.getName(), s.getHost(), s.getPort(), false, s.getMetadata()))
+            .collect(Collectors.toList());
+    }
+
+    @Override
+    public List<String> getServices() {
+        return Collections.emptyList();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancer.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancer.java
new file mode 100644
index 0000000..2cf208d
--- /dev/null
+++ b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancer.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.cloud;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.cloud.LoadBalancer;
+import org.apache.camel.cloud.LoadBalancerFunction;
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.impl.cloud.DefaultServiceDefinition;
+import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.client.ServiceInstance;
+import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
+
+public class CamelSpringCloudLoadBalancer extends ServiceSupport implements CamelContextAware, LoadBalancer {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CamelSpringCloudLoadBalancer.class);
+
+    private final LoadBalancerClient loadBalancerClient;
+    private CamelContext camelContext;
+
+    public CamelSpringCloudLoadBalancer(LoadBalancerClient loadBalancerClient) {
+        this.loadBalancerClient = loadBalancerClient;
+    }
+
+    @Override
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    @Override
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        ObjectHelper.notNull(camelContext, "camelContext");
+        ObjectHelper.notNull(loadBalancerClient, "loadBalancerClient");
+
+        LOGGER.info("ServiceCall is using cloud load balancer of type: {}", loadBalancerClient.getClass());
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+    }
+
+    @Override
+    public <T> T process(String serviceName, LoadBalancerFunction<T> function) throws Exception {
+        return loadBalancerClient.execute(serviceName,  i -> function.apply(instanceToDefinition(i)));
+    }
+
+    // *******************************
+    // Helpers
+    // *******************************
+
+    private ServiceDefinition instanceToDefinition(ServiceInstance instance) {
+        return new DefaultServiceDefinition(
+            instance.getServiceId(),
+            instance.getHost(),
+            instance.getPort(),
+            instance.getMetadata()
+        );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancerAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancerAutoConfiguration.java b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancerAutoConfiguration.java
new file mode 100644
index 0000000..8ac2119
--- /dev/null
+++ b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelSpringCloudLoadBalancerAutoConfiguration.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.cloud;
+
+
+import org.apache.camel.cloud.LoadBalancer;
+import org.apache.camel.spring.boot.cloud.CamelCloudAutoConfiguration;
+import org.apache.camel.spring.boot.cloud.CamelCloudConfigurationProperties;
+import org.apache.camel.spring.boot.cloud.CamelCloudServiceDiscovery;
+import org.apache.camel.spring.boot.cloud.CamelCloudServiceDiscoveryAutoConfiguration;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.cloud.client.discovery.DiscoveryClient;
+import org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration;
+import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConditionalOnBean({ CamelCloudAutoConfiguration.class, LoadBalancerClient.class })
+@AutoConfigureAfter({ LoadBalancerAutoConfiguration.class, CamelCloudServiceDiscoveryAutoConfiguration.class })
+@EnableConfigurationProperties(CamelCloudConfigurationProperties.class)
+@Conditional(CamelSpringCloudLoadBalancerAutoConfiguration.LoadBalancerCondition.class)
+public class CamelSpringCloudLoadBalancerAutoConfiguration {
+    @Bean(name = "load-balancer")
+    public LoadBalancer cloudLoadBalancer(LoadBalancerClient loadBalancerClient) {
+        return new CamelSpringCloudLoadBalancer(loadBalancerClient);
+    }
+
+    @Bean(name = "load-balancer-discovery-client")
+    public DiscoveryClient serviceDiscoveryClient(CamelCloudServiceDiscovery serviceDiscovery) {
+        return new CamelSpringCloudDiscoveryClient("service-discovery-client", serviceDiscovery);
+    }
+
+    // *******************************
+    // Condition
+    // *******************************
+
+    public static class LoadBalancerCondition extends GroupCondition {
+        public LoadBalancerCondition() {
+            super(
+                "camel.cloud",
+                "camel.cloud.load-balancer"
+            );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/resources/META-INF/spring.factories b/components/camel-spring-cloud/src/main/resources/META-INF/spring.factories
index a183cdd..fc59127 100644
--- a/components/camel-spring-cloud/src/main/resources/META-INF/spring.factories
+++ b/components/camel-spring-cloud/src/main/resources/META-INF/spring.factories
@@ -16,8 +16,4 @@
 #
 
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.apache.camel.spring.cloud.CamelCloudAutoConfiguration,\
-org.apache.camel.spring.cloud.CamelCloudServiceDiscoveryAutoConfiguration,\
-org.apache.camel.spring.cloud.CamelCloudServiceFilterAutoConfiguration,\
-org.apache.camel.spring.cloud.CamelCloudServiceChooserAutoConfiguration,\
-org.apache.camel.spring.cloud.CamelCloudLoadBalancerAutoConfiguration
+org.apache.camel.spring.cloud.CamelSpringCloudLoadBalancerAutoConfiguration

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallConfigurationTest.java b/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallConfigurationTest.java
deleted file mode 100644
index 42c821a..0000000
--- a/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallConfigurationTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.spring.cloud;
-
-import org.apache.camel.cloud.LoadBalancer;
-import org.apache.camel.cloud.ServiceChooser;
-import org.apache.camel.cloud.ServiceDiscovery;
-import org.apache.camel.cloud.ServiceFilter;
-import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.ApplicationContext;
-import org.springframework.core.env.Environment;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-@DirtiesContext
-@RunWith(SpringRunner.class)
-@SpringBootApplication()
-@SpringBootTest(
-    classes = {
-        CamelAutoConfiguration.class,
-        CamelCloudAutoConfiguration.class,
-        CamelCloudServiceChooserAutoConfiguration.class
-    },
-    properties = {
-        "camel.cloud.enabled=false",
-        "camel.cloud.service-discovery.enabled=false",
-        "camel.cloud.service-filter.enabled=false",
-        "camel.cloud.service-chooser.enabled=true",
-        "camel.cloud.load-balancer.enabled=false",
-        "debug=false"
-    }
-)
-public class CamelCloudServiceCallConfigurationTest {
-    @Autowired
-    private ApplicationContext ctx;
-
-    @Test
-    public void doTest() throws Exception {
-        Environment env = ctx.getEnvironment();
-
-        assertFalse(env.getProperty("camel.cloud.enabled", Boolean.class));
-        assertFalse(env.getProperty("camel.cloud.service-discovery.enabled", Boolean.class));
-        assertFalse(env.getProperty("camel.cloud.service-filter.enabled", Boolean.class));
-        assertTrue(env.getProperty("camel.cloud.service-chooser.enabled", Boolean.class));
-        assertFalse(env.getProperty("camel.cloud.load-balancer.enabled", Boolean.class));
-
-        assertTrue(ctx.getBeansOfType(ServiceDiscovery.class).isEmpty());
-        assertTrue(ctx.getBeansOfType(ServiceFilter.class).isEmpty());
-        assertTrue(ctx.getBeansOfType(ServiceChooser.class).isEmpty());
-        assertTrue(ctx.getBeansOfType(LoadBalancer.class).isEmpty());
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRibbonTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRibbonTest.java b/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRibbonTest.java
deleted file mode 100644
index 01fb0c6..0000000
--- a/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRibbonTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.spring.cloud;
-
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@DirtiesContext
-@RunWith(SpringRunner.class)
-@SpringBootApplication
-@SpringBootTest(
-    classes = {
-        CamelAutoConfiguration.class,
-        CamelCloudAutoConfiguration.class,
-        CamelCloudServiceCallRoutesAutoConfiguration.class
-    },
-    properties = {
-        "ribbon.eureka.enabled=false",
-        "ribbon.listOfServers=localhost:9090,localhost:9092",
-        "ribbon.ServerListRefreshInterval=15000",
-        "debug=false"
-    }
-)
-public class CamelCloudServiceCallRibbonTest {
-    @Autowired
-    private ProducerTemplate template;
-
-    @Test
-    public void testServiceCall() throws Exception {
-        Assert.assertEquals("9090", template.requestBody("direct:start", null, String.class));
-        Assert.assertEquals("9092", template.requestBody("direct:start", null, String.class));
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/camel/blob/61e50869/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRoutesAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRoutesAutoConfiguration.java b/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRoutesAutoConfiguration.java
deleted file mode 100644
index ed5bb63..0000000
--- a/components/camel-spring-cloud/src/test/java/org/apache/camel/spring/cloud/CamelCloudServiceCallRoutesAutoConfiguration.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.spring.cloud;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.springframework.context.annotation.Bean;
-
-public class CamelCloudServiceCallRoutesAutoConfiguration {
-    @Bean
-    public RouteBuilder myRouteBuilder() {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    .serviceCall()
-                       .name("custom-svc-list/hello");
-
-                from("jetty:http://localhost:9090/hello")
-                    .transform()
-                    .constant("9090");
-                from("jetty:http://localhost:9091/hello")
-                    .transform()
-                    .constant("9091");
-                from("jetty:http://localhost:9092/hello")
-                    .transform()
-                    .constant("9092");
-            }
-        };
-    }
-}
-
-


Mime
View raw message