Repository: camel
Updated Branches:
  refs/heads/master 465cfa557 -> 57eb512db


cluster-service: auto detect cluster service


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

Branch: refs/heads/master
Commit: 3d99fc3491b91ecd41e061f4c416d128e2c8db43
Parents: 465cfa5
Author: lburgazzoli <lburgazz...@gmail.com>
Authored: Mon Jun 26 17:35:09 2017 +0200
Committer: lburgazzoli <lburgazz...@gmail.com>
Committed: Tue Jun 27 10:27:17 2017 +0200

----------------------------------------------------------------------
 .../camel/core/xml/AbstractCamelContextFactoryBean.java  |  7 +++++++
 .../apache/camel/spring/boot/CamelAutoConfiguration.java | 11 +++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3d99fc34/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git 
a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
 
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
index a9d0f98..64e9937 100644
--- 
a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
+++ 
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
@@ -45,6 +45,7 @@ import 
org.apache.camel.component.properties.PropertiesFunction;
 import org.apache.camel.component.properties.PropertiesLocation;
 import org.apache.camel.component.properties.PropertiesParser;
 import org.apache.camel.component.properties.PropertiesResolver;
+import org.apache.camel.ha.CamelClusterService;
 import org.apache.camel.management.DefaultManagementAgent;
 import org.apache.camel.management.DefaultManagementLifecycleStrategy;
 import org.apache.camel.management.DefaultManagementStrategy;
@@ -322,6 +323,12 @@ public abstract class AbstractCamelContextFactoryBean<T 
extends ModelCamelContex
                 }
             }
         }
+        // cluster service
+        CamelClusterService clusterService = 
getBeanForType(CamelClusterService.class);
+        if (clusterService != null) {
+            LOG.info("Using CamelClusterService: " + clusterService);
+            getContext().addService(clusterService);
+        }
         // add route policy factories
         Map<String, RoutePolicyFactory> routePolicyFactories = 
getContext().getRegistry().findByTypeWithName(RoutePolicyFactory.class);
         if (routePolicyFactories != null && !routePolicyFactories.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/3d99fc34/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index e232c12..2c9f53d 100644
--- 
a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -29,6 +29,7 @@ import org.apache.camel.ProducerTemplate;
 import org.apache.camel.TypeConverters;
 import org.apache.camel.component.properties.PropertiesComponent;
 import org.apache.camel.component.properties.PropertiesParser;
+import org.apache.camel.ha.CamelClusterService;
 import org.apache.camel.impl.FileWatcherReloadStrategy;
 import org.apache.camel.processor.interceptor.BacklogTracer;
 import org.apache.camel.processor.interceptor.DefaultTraceFormatter;
@@ -86,7 +87,7 @@ public class CamelAutoConfiguration {
     @Bean(destroyMethod = "")
     @ConditionalOnMissingBean(CamelContext.class)
     CamelContext camelContext(ApplicationContext applicationContext,
-                              CamelConfigurationProperties config) {
+                              CamelConfigurationProperties config) throws 
Exception {
 
         if (ObjectHelper.isNotEmpty(config.getFileConfigurations())) {
             Environment env = applicationContext.getEnvironment();
@@ -296,7 +297,7 @@ public class CamelAutoConfiguration {
      * <p/>
      * Similar code in camel-core-xml module in class 
org.apache.camel.core.xml.AbstractCamelContextFactoryBean.
      */
-    void afterPropertiesSet(ApplicationContext applicationContext, 
CamelContext camelContext) {
+    void afterPropertiesSet(ApplicationContext applicationContext, 
CamelContext camelContext) throws Exception {
         Tracer tracer = getSingleBeanOfType(applicationContext, Tracer.class);
         if (tracer != null) {
             // use formatter if there is a TraceFormatter bean defined
@@ -412,6 +413,12 @@ public class CamelAutoConfiguration {
                 }
             }
         }
+        // cluster service
+        CamelClusterService clusterService = 
getSingleBeanOfType(applicationContext, CamelClusterService.class);
+        if (clusterService != null) {
+            LOG.info("Using CamelClusterService: " + clusterService);
+            camelContext.addService(clusterService);
+        }
         // add route policy factories
         Map<String, RoutePolicyFactory> routePolicyFactories = 
applicationContext.getBeansOfType(RoutePolicyFactory.class);
         if (routePolicyFactories != null && !routePolicyFactories.isEmpty()) {

Reply via email to