CAMEL-10992: Hystrix - Allow to configure global configuration

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

Branch: refs/heads/master
Commit: b4d0038a726525add4f032b6c3b45c030a3a760b
Parents: 9628b85
Author: lburgazzoli <lburgazz...@gmail.com>
Authored: Mon Mar 13 18:21:25 2017 +0100
Committer: lburgazzoli <lburgazz...@gmail.com>
Committed: Tue Mar 14 21:18:10 2017 +0100

----------------------------------------------------------------------
 camel-core/pom.xml                              |   5 +
 .../docs/eips/hystrixConfiguration-eip.adoc     |  62 +--
 .../java/org/apache/camel/CamelContext.java     |  32 ++
 .../apache/camel/impl/DefaultCamelContext.java  |  30 ++
 .../camel/impl/TypedProcessorFactory.java       |  57 +++
 .../camel/model/HystrixConfigurationCommon.java | 374 +++++++++++++++++
 .../model/HystrixConfigurationDefinition.java   | 410 ++-----------------
 .../model/cloud/ServiceCallDefinition.java      |  17 +-
 .../apache/camel/util/function/Suppliers.java   |   5 +-
 .../blueprint/CamelContextFactoryBean.java      |  11 +
 .../camel/cdi/xml/CamelContextFactoryBean.java  |  12 +
 .../xml/AbstractCamelContextFactoryBean.java    |  14 +-
 .../hystrix/processor/HystrixConstants.java     |   1 +
 .../processor/HystrixProcessorFactory.java      | 220 +++++-----
 .../HystrixHierarchicalConfigTest.java          | 134 ++++++
 .../processor/HystrixRouteConfigTest.java       |   1 +
 ...SpringHystrixRouteConfigMaximumSizeTest.java |   2 +
 .../SpringHystrixRouteConfigRefTest.java        |   2 +
 .../processor/SpringHystrixRouteConfigTest.java |   2 +
 .../SpringHystrixRouteFallbackTest.java         |   2 +
 ...pringHystrixRouteHierarchicalConfigTest.java |  68 +++
 .../processor/SpringHystrixRouteOkTest.java     |   2 +
 ...SpringHystrixRouteHierarchicalConfigTest.xml |  51 +++
 .../camel/spring/CamelContextFactoryBean.java   |  11 +
 .../spring/handler/CamelNamespaceHandler.java   |   5 +-
 .../springboot/HystrixAutoConfiguration.java    |  59 +++
 .../springboot/HystrixConfiguration.java        |  27 ++
 .../main/resources/META-INF/spring.factories    |   1 +
 .../HystrixHierarchicalConfiguration.java       |  54 +++
 .../HystrixHierarchicalConfigurationTest.java   |  78 ++++
 .../src/test/resources/logback.xml              |  39 ++
 31 files changed, 1268 insertions(+), 520 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/pom.xml
----------------------------------------------------------------------
diff --git a/camel-core/pom.xml b/camel-core/pom.xml
index b9f6430..2466dba 100644
--- a/camel-core/pom.xml
+++ b/camel-core/pom.xml
@@ -196,6 +196,11 @@
       <version>${xml-resolver-version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.bazaarvoice.jolt</groupId>
+      <artifactId>jolt-core</artifactId>
+      <version>0.0.23</version>
+    </dependency>
 
   </dependencies>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc 
b/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc
index ca061db..69df9c6 100644
--- a/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc
+++ b/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc
@@ -8,36 +8,36 @@ The Hystrix Configuration EIP supports 31 options which are 
listed below:
 [width="100%",cols="3,1m,6",options="header"]
 |=======================================================================
 | Name | Java Type | Description
-| groupKey | String | Sets the group key to use. The default value is 
CamelHystrix.
-| threadPoolKey | String | Sets the thread pool key to use. Will by default 
use the same value as groupKey has been configured to use.
-| circuitBreakerEnabled | Boolean | Whether to use a HystrixCircuitBreaker or 
not. If false no circuit-breaker logic will be used and all requests permitted. 
This is similar in effect to circuitBreakerForceClosed() except that continues 
tracking metrics and knowing whether it should be open/closed this property 
results in not even instantiating a circuit-breaker.
-| circuitBreakerErrorThresholdPercentage | Integer | Error percentage 
threshold (as whole number such as 50) at which point the circuit breaker will 
trip open and reject requests. It will stay tripped for the duration defined in 
circuitBreakerSleepWindowInMilliseconds; The error percentage this is compared 
against comes from HystrixCommandMetrics.getHealthCounts().
-| circuitBreakerForceClosed | Boolean | If true the 
HystrixCircuitBreakerallowRequest() will always return true to allow requests 
regardless of the error percentage from 
HystrixCommandMetrics.getHealthCounts(). The circuitBreakerForceOpen() property 
takes precedence so if it set to true this property does nothing.
-| circuitBreakerForceOpen | Boolean | If true the 
HystrixCircuitBreaker.allowRequest() will always return false causing the 
circuit to be open (tripped) and reject all requests. This property takes 
precedence over circuitBreakerForceClosed();
-| circuitBreakerRequestVolumeThreshold | Integer | Minimum number of requests 
in the metricsRollingStatisticalWindowInMilliseconds() that must exist before 
the HystrixCircuitBreaker will trip. If below this number the circuit will not 
trip regardless of error percentage.
-| circuitBreakerSleepWindowInMilliseconds | Integer | The time in milliseconds 
after a HystrixCircuitBreaker trips open that it should wait before trying 
requests again.
-| executionIsolationSemaphoreMaxConcurrentRequests | Integer | Number of 
concurrent requests permitted to HystrixCommand.run(). Requests beyond the 
concurrent limit will be rejected. Applicable only when 
executionIsolationStrategy == SEMAPHORE.
-| executionIsolationStrategy | String | What isolation strategy 
HystrixCommand.run() will be executed with. If THREAD then it will be executed 
on a separate thread and concurrent requests limited by the number of threads 
in the thread-pool. If SEMAPHORE then it will be executed on the calling thread 
and concurrent requests limited by the semaphore count.
-| executionIsolationThreadInterruptOnTimeout | Boolean | Whether the execution 
thread should attempt an interrupt (using link Futurecancel) when a thread 
times out. Applicable only when executionIsolationStrategy() == THREAD.
-| executionTimeoutInMilliseconds | Integer | Time in milliseconds at which 
point the command will timeout and halt execution. If link 
executionIsolationThreadInterruptOnTimeout == true and the command is 
thread-isolated the executing thread will be interrupted. If the command is 
semaphore-isolated and a HystrixObservableCommand that command will get 
unsubscribed.
-| executionTimeoutEnabled | Boolean | Whether the timeout mechanism is enabled 
for this command
-| fallbackIsolationSemaphoreMaxConcurrentRequests | Integer | Number of 
concurrent requests permitted to HystrixCommand.getFallback(). Requests beyond 
the concurrent limit will fail-fast and not attempt retrieving a fallback.
-| fallbackEnabled | Boolean | Whether HystrixCommand.getFallback() should be 
attempted when failure occurs.
-| metricsHealthSnapshotIntervalInMilliseconds | Integer | Time in milliseconds 
to wait between allowing health snapshots to be taken that calculate success 
and error percentages and affect HystrixCircuitBreaker.isOpen() status. On 
high-volume circuits the continual calculation of error percentage can become 
CPU intensive thus this controls how often it is calculated.
-| metricsRollingPercentileBucketSize | Integer | Maximum number of values 
stored in each bucket of the rolling percentile. This is passed into 
HystrixRollingPercentile inside HystrixCommandMetrics.
-| metricsRollingPercentileEnabled | Boolean | Whether percentile metrics 
should be captured using HystrixRollingPercentile inside HystrixCommandMetrics.
-| metricsRollingPercentileWindowInMilliseconds | Integer | Duration of 
percentile rolling window in milliseconds. This is passed into 
HystrixRollingPercentile inside HystrixCommandMetrics.
-| metricsRollingPercentileWindowBuckets | Integer | Number of buckets the 
rolling percentile window is broken into. This is passed into 
HystrixRollingPercentile inside HystrixCommandMetrics.
-| metricsRollingStatisticalWindowInMilliseconds | Integer | This property sets 
the duration of the statistical rolling window in milliseconds. This is how 
long metrics are kept for the thread pool. The window is divided into buckets 
and rolls by those increments.
-| metricsRollingStatisticalWindowBuckets | Integer | Number of buckets the 
rolling statistical window is broken into. This is passed into 
HystrixRollingNumber inside HystrixCommandMetrics.
-| requestLogEnabled | Boolean | Whether HystrixCommand execution and events 
should be logged to HystrixRequestLog.
-| corePoolSize | Integer | Core thread-pool size that gets passed to link 
java.util.concurrent.ThreadPoolExecutorsetCorePoolSize(int)
-| maximumSize | Integer | Maximum thread-pool size that gets passed to link 
ThreadPoolExecutorsetMaximumPoolSize(int). This is the maximum amount of 
concurrency that can be supported without starting to reject HystrixCommands. 
Please note that this setting only takes effect if you also set 
allowMaximumSizeToDivergeFromCoreSize
-| keepAliveTime | Integer | Keep-alive time in minutes that gets passed to 
link ThreadPoolExecutorsetKeepAliveTime(long TimeUnit)
-| maxQueueSize | Integer | Max queue size that gets passed to BlockingQueue in 
HystrixConcurrencyStrategy.getBlockingQueue(int) This should only affect the 
instantiation of a threadpool - it is not eliglible to change a queue size on 
the fly. For that use queueSizeRejectionThreshold().
-| queueSizeRejectionThreshold | Integer | Queue size rejection threshold is an 
artificial max size at which rejections will occur even if link maxQueueSize 
has not been reached. This is done because the link maxQueueSize of a 
BlockingQueue can not be dynamically changed and we want to support dynamically 
changing the queue size that affects rejections. This is used by HystrixCommand 
when queuing a thread for execution.
-| threadPoolRollingNumberStatisticalWindowInMilliseconds | Integer | Duration 
of statistical rolling window in milliseconds. This is passed into 
HystrixRollingNumber inside each HystrixThreadPoolMetrics instance.
-| threadPoolRollingNumberStatisticalWindowBuckets | Integer | Number of 
buckets the rolling statistical window is broken into. This is passed into 
HystrixRollingNumber inside each HystrixThreadPoolMetrics instance.
-| allowMaximumSizeToDivergeFromCoreSize | Boolean | Allows the configuration 
for maximumSize to take effect. That value can then be equal to or higher than 
coreSize
+| groupKey | String | 
+| threadPoolKey | String | 
+| circuitBreakerEnabled | Boolean | 
+| circuitBreakerErrorThresholdPercentage | Integer | 
+| circuitBreakerForceClosed | Boolean | 
+| circuitBreakerForceOpen | Boolean | 
+| circuitBreakerRequestVolumeThreshold | Integer | 
+| circuitBreakerSleepWindowInMilliseconds | Integer | 
+| executionIsolationSemaphoreMaxConcurrentRequests | Integer | 
+| executionIsolationStrategy | String | 
+| executionIsolationThreadInterruptOnTimeout | Boolean | 
+| executionTimeoutInMilliseconds | Integer | 
+| executionTimeoutEnabled | Boolean | 
+| fallbackIsolationSemaphoreMaxConcurrentRequests | Integer | 
+| fallbackEnabled | Boolean | 
+| metricsHealthSnapshotIntervalInMilliseconds | Integer | 
+| metricsRollingPercentileBucketSize | Integer | 
+| metricsRollingPercentileEnabled | Boolean | 
+| metricsRollingPercentileWindowInMilliseconds | Integer | 
+| metricsRollingPercentileWindowBuckets | Integer | 
+| metricsRollingStatisticalWindowInMilliseconds | Integer | 
+| metricsRollingStatisticalWindowBuckets | Integer | 
+| requestLogEnabled | Boolean | 
+| corePoolSize | Integer | 
+| maximumSize | Integer | 
+| keepAliveTime | Integer | 
+| maxQueueSize | Integer | 
+| queueSizeRejectionThreshold | Integer | 
+| threadPoolRollingNumberStatisticalWindowInMilliseconds | Integer | 
+| threadPoolRollingNumberStatisticalWindowBuckets | Integer | 
+| allowMaximumSizeToDivergeFromCoreSize | Boolean | 
 |=======================================================================
 // eip options: END

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/java/org/apache/camel/CamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java 
b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index a8bc8ef..1d5be88 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -31,6 +31,7 @@ import 
org.apache.camel.api.management.mbean.ManagedRouteMBean;
 import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.catalog.RuntimeCamelCatalog;
 import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.model.HystrixConfigurationDefinition;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.model.RoutesDefinition;
@@ -605,6 +606,37 @@ public interface CamelContext extends SuspendableService, 
RuntimeConfiguration {
     void addServiceCallConfiguration(String serviceName, 
ServiceCallConfigurationDefinition configuration);
 
     /**
+     * Gets the Hystrix configuration by the given name. If no name is given
+     * the default configuration is returned, see 
<tt>setHystrixConfiguration</tt>
+     *
+     * @param id id of the configuration, or <tt>null</tt> to return the 
default configuration
+     * @return the configuration, or <tt>null</tt> if no configuration has 
been registered
+     */
+    HystrixConfigurationDefinition getHystrixConfiguration(String id);
+
+    /**
+     * Sets the default Hystrix configuration
+     *
+     * @param configuration the configuration
+     */
+    void setHystrixConfiguration(HystrixConfigurationDefinition configuration);
+
+    /**
+     * Sets the Hystrix configurations
+     *
+     * @param configurations the configuration list
+     */
+    void setHystrixConfigurations(List<HystrixConfigurationDefinition> 
configurations);
+
+    /**
+     * Adds the Hystrix configuration
+     *
+     * @param id name of the configuration
+     * @param configuration the configuration
+     */
+    void addHystrixConfiguration(String id, HystrixConfigurationDefinition 
configuration);
+
+    /**
      * Returns the order in which the route inputs was started.
      * <p/>
      * The order may not be according to the startupOrder defined on the route.

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java 
b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 5df4dd8..a171645 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -100,6 +100,7 @@ import org.apache.camel.management.JmxSystemPropertyKeys;
 import org.apache.camel.management.ManagementStrategyFactory;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.model.FromDefinition;
+import org.apache.camel.model.HystrixConfigurationDefinition;
 import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.model.ModelHelper;
 import org.apache.camel.model.ProcessorDefinition;
@@ -226,6 +227,7 @@ public class DefaultCamelContext extends ServiceSupport 
implements ModelCamelCon
     private final List<RestDefinition> restDefinitions = new 
ArrayList<RestDefinition>();
     private Map<String, RestConfiguration> restConfigurations = new 
ConcurrentHashMap<>();
     private Map<String, ServiceCallConfigurationDefinition> 
serviceCallConfigurations = new ConcurrentHashMap<>();
+    private Map<String, HystrixConfigurationDefinition> hystrixConfigurations 
= new ConcurrentHashMap<>();
     private RestRegistry restRegistry = new DefaultRestRegistry();
     private List<InterceptStrategy> interceptStrategies = new 
ArrayList<InterceptStrategy>();
     private List<RoutePolicyFactory> routePolicyFactories = new 
ArrayList<RoutePolicyFactory>();
@@ -2617,6 +2619,34 @@ public class DefaultCamelContext extends ServiceSupport 
implements ModelCamelCon
         serviceCallConfigurations.put(serviceName, configuration);
     }
 
+    @Override
+    public HystrixConfigurationDefinition getHystrixConfiguration(String id) {
+        if (id == null) {
+            id = "";
+        }
+
+        return hystrixConfigurations.get(id);
+    }
+
+    @Override
+    public void setHystrixConfiguration(HystrixConfigurationDefinition 
configuration) {
+        hystrixConfigurations.put("", configuration);
+    }
+
+    @Override
+    public void setHystrixConfigurations(List<HystrixConfigurationDefinition> 
configurations) {
+        if (configurations != null) {
+            for (HystrixConfigurationDefinition configuration : 
configurations) {
+                hystrixConfigurations.put(configuration.getId(), 
configuration);
+            }
+        }
+    }
+
+    @Override
+    public void addHystrixConfiguration(String id, 
HystrixConfigurationDefinition configuration) {
+        hystrixConfigurations.put(id, configuration);
+    }
+
     public List<InterceptStrategy> getInterceptStrategies() {
         return interceptStrategies;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java 
b/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
new file mode 100644
index 0000000..f0aa1b8
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
@@ -0,0 +1,57 @@
+/**
+ * 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.impl;
+
+import org.apache.camel.Processor;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.spi.ProcessorFactory;
+import org.apache.camel.spi.RouteContext;
+
+public class TypedProcessorFactory<T extends ProcessorDefinition<T>> 
implements ProcessorFactory {
+    private final Class<T> type;
+
+    protected TypedProcessorFactory(Class<T> type) {
+        this.type = type;
+    }
+
+    @Override
+    public Processor createChildProcessor(RouteContext routeContext, 
ProcessorDefinition<?> definition, boolean mandatory) throws Exception {
+        if (definition != null && type.isInstance(definition)) {
+            return doCreateChildProcessor(routeContext, type.cast(definition), 
mandatory);
+        }
+
+        return null;
+    }
+
+    @Override
+    public Processor createProcessor(RouteContext routeContext, 
ProcessorDefinition<?> definition) throws Exception {
+        if (definition != null && type.isInstance(definition)) {
+            return doCreateProcessor(routeContext, type.cast(definition));
+        }
+
+        return null;
+    }
+
+
+    protected Processor doCreateChildProcessor(RouteContext routeContext, T 
definition, boolean mandatory) throws Exception {
+        return null;
+    }
+
+    public Processor doCreateProcessor(RouteContext routeContext, T 
definition) throws Exception {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationCommon.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationCommon.java
 
b/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationCommon.java
new file mode 100644
index 0000000..fa91fff
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationCommon.java
@@ -0,0 +1,374 @@
+/**
+ * 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.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+import org.apache.camel.spi.Metadata;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+public class HystrixConfigurationCommon extends IdentifiedType {
+
+    @XmlAttribute @Metadata(defaultValue = "CamelHystrix")
+    private String groupKey;
+    @XmlAttribute @Metadata(defaultValue = "CamelHystrix")
+    private String threadPoolKey;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "true")
+    private Boolean circuitBreakerEnabled;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "50")
+    private Integer circuitBreakerErrorThresholdPercentage;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "true")
+    private Boolean circuitBreakerForceClosed;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "false")
+    private Boolean circuitBreakerForceOpen;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "20")
+    private Integer circuitBreakerRequestVolumeThreshold;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "5000")
+    private Integer circuitBreakerSleepWindowInMilliseconds;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "20")
+    private Integer executionIsolationSemaphoreMaxConcurrentRequests;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "THREAD", enums = 
"THREAD,SEMAPHORE")
+    private String executionIsolationStrategy;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "true")
+    private Boolean executionIsolationThreadInterruptOnTimeout;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "1000")
+    private Integer executionTimeoutInMilliseconds;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "true")
+    private Boolean executionTimeoutEnabled;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "10")
+    private Integer fallbackIsolationSemaphoreMaxConcurrentRequests;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "true")
+    private Boolean fallbackEnabled;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "500")
+    private Integer metricsHealthSnapshotIntervalInMilliseconds;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "10")
+    private Integer metricsRollingPercentileBucketSize;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "true")
+    private Boolean metricsRollingPercentileEnabled;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "10000")
+    private Integer metricsRollingPercentileWindowInMilliseconds;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "6")
+    private Integer metricsRollingPercentileWindowBuckets;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "10000")
+    private Integer metricsRollingStatisticalWindowInMilliseconds;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "10")
+    private Integer metricsRollingStatisticalWindowBuckets;
+    @XmlAttribute
+    @Metadata(label = "command", defaultValue = "true")
+    private Boolean requestLogEnabled;
+
+    // thread-pool
+
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "10")
+    private Integer corePoolSize;
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "10")
+    private Integer maximumSize;
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "1")
+    private Integer keepAliveTime;
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "-1")
+    private Integer maxQueueSize;
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "5")
+    private Integer queueSizeRejectionThreshold;
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "10000")
+    private Integer threadPoolRollingNumberStatisticalWindowInMilliseconds;
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "10")
+    private Integer threadPoolRollingNumberStatisticalWindowBuckets;
+    @XmlAttribute
+    @Metadata(label = "threadpool", defaultValue = "false")
+    private Boolean allowMaximumSizeToDivergeFromCoreSize;
+
+
+    // Getter/Setter
+    // 
-------------------------------------------------------------------------
+
+    public String getGroupKey() {
+        return groupKey;
+    }
+
+    public void setGroupKey(String groupKey) {
+        this.groupKey = groupKey;
+    }
+
+    public String getThreadPoolKey() {
+        return threadPoolKey;
+    }
+
+    public void setThreadPoolKey(String threadPoolKey) {
+        this.threadPoolKey = threadPoolKey;
+    }
+
+    public Boolean getCircuitBreakerEnabled() {
+        return circuitBreakerEnabled;
+    }
+
+    public void setCircuitBreakerEnabled(Boolean circuitBreakerEnabled) {
+        this.circuitBreakerEnabled = circuitBreakerEnabled;
+    }
+
+    public Integer getCircuitBreakerErrorThresholdPercentage() {
+        return circuitBreakerErrorThresholdPercentage;
+    }
+
+    public void setCircuitBreakerErrorThresholdPercentage(Integer 
circuitBreakerErrorThresholdPercentage) {
+        this.circuitBreakerErrorThresholdPercentage = 
circuitBreakerErrorThresholdPercentage;
+    }
+
+    public Boolean getCircuitBreakerForceClosed() {
+        return circuitBreakerForceClosed;
+    }
+
+    public void setCircuitBreakerForceClosed(Boolean 
circuitBreakerForceClosed) {
+        this.circuitBreakerForceClosed = circuitBreakerForceClosed;
+    }
+
+    public Boolean getCircuitBreakerForceOpen() {
+        return circuitBreakerForceOpen;
+    }
+
+    public void setCircuitBreakerForceOpen(Boolean circuitBreakerForceOpen) {
+        this.circuitBreakerForceOpen = circuitBreakerForceOpen;
+    }
+
+    public Integer getCircuitBreakerRequestVolumeThreshold() {
+        return circuitBreakerRequestVolumeThreshold;
+    }
+
+    public void setCircuitBreakerRequestVolumeThreshold(Integer 
circuitBreakerRequestVolumeThreshold) {
+        this.circuitBreakerRequestVolumeThreshold = 
circuitBreakerRequestVolumeThreshold;
+    }
+
+    public Integer getCircuitBreakerSleepWindowInMilliseconds() {
+        return circuitBreakerSleepWindowInMilliseconds;
+    }
+
+    public void setCircuitBreakerSleepWindowInMilliseconds(Integer 
circuitBreakerSleepWindowInMilliseconds) {
+        this.circuitBreakerSleepWindowInMilliseconds = 
circuitBreakerSleepWindowInMilliseconds;
+    }
+
+    public Integer getExecutionIsolationSemaphoreMaxConcurrentRequests() {
+        return executionIsolationSemaphoreMaxConcurrentRequests;
+    }
+
+    public void setExecutionIsolationSemaphoreMaxConcurrentRequests(Integer 
executionIsolationSemaphoreMaxConcurrentRequests) {
+        this.executionIsolationSemaphoreMaxConcurrentRequests = 
executionIsolationSemaphoreMaxConcurrentRequests;
+    }
+
+    public String getExecutionIsolationStrategy() {
+        return executionIsolationStrategy;
+    }
+
+    public void setExecutionIsolationStrategy(String 
executionIsolationStrategy) {
+        this.executionIsolationStrategy = executionIsolationStrategy;
+    }
+
+    public Boolean getExecutionIsolationThreadInterruptOnTimeout() {
+        return executionIsolationThreadInterruptOnTimeout;
+    }
+
+    public void setExecutionIsolationThreadInterruptOnTimeout(Boolean 
executionIsolationThreadInterruptOnTimeout) {
+        this.executionIsolationThreadInterruptOnTimeout = 
executionIsolationThreadInterruptOnTimeout;
+    }
+
+    public Integer getExecutionTimeoutInMilliseconds() {
+        return executionTimeoutInMilliseconds;
+    }
+
+    public void setExecutionTimeoutInMilliseconds(Integer 
executionTimeoutInMilliseconds) {
+        this.executionTimeoutInMilliseconds = executionTimeoutInMilliseconds;
+    }
+
+    public Boolean getExecutionTimeoutEnabled() {
+        return executionTimeoutEnabled;
+    }
+
+    public void setExecutionTimeoutEnabled(Boolean executionTimeoutEnabled) {
+        this.executionTimeoutEnabled = executionTimeoutEnabled;
+    }
+
+    public Integer getFallbackIsolationSemaphoreMaxConcurrentRequests() {
+        return fallbackIsolationSemaphoreMaxConcurrentRequests;
+    }
+
+    public void setFallbackIsolationSemaphoreMaxConcurrentRequests(Integer 
fallbackIsolationSemaphoreMaxConcurrentRequests) {
+        this.fallbackIsolationSemaphoreMaxConcurrentRequests = 
fallbackIsolationSemaphoreMaxConcurrentRequests;
+    }
+
+    public Boolean getFallbackEnabled() {
+        return fallbackEnabled;
+    }
+
+    public void setFallbackEnabled(Boolean fallbackEnabled) {
+        this.fallbackEnabled = fallbackEnabled;
+    }
+
+    public Integer getMetricsHealthSnapshotIntervalInMilliseconds() {
+        return metricsHealthSnapshotIntervalInMilliseconds;
+    }
+
+    public void setMetricsHealthSnapshotIntervalInMilliseconds(Integer 
metricsHealthSnapshotIntervalInMilliseconds) {
+        this.metricsHealthSnapshotIntervalInMilliseconds = 
metricsHealthSnapshotIntervalInMilliseconds;
+    }
+
+    public Integer getMetricsRollingPercentileBucketSize() {
+        return metricsRollingPercentileBucketSize;
+    }
+
+    public void setMetricsRollingPercentileBucketSize(Integer 
metricsRollingPercentileBucketSize) {
+        this.metricsRollingPercentileBucketSize = 
metricsRollingPercentileBucketSize;
+    }
+
+    public Boolean getMetricsRollingPercentileEnabled() {
+        return metricsRollingPercentileEnabled;
+    }
+
+    public void setMetricsRollingPercentileEnabled(Boolean 
metricsRollingPercentileEnabled) {
+        this.metricsRollingPercentileEnabled = metricsRollingPercentileEnabled;
+    }
+
+    public Integer getMetricsRollingPercentileWindowInMilliseconds() {
+        return metricsRollingPercentileWindowInMilliseconds;
+    }
+
+    public void setMetricsRollingPercentileWindowInMilliseconds(Integer 
metricsRollingPercentileWindowInMilliseconds) {
+        this.metricsRollingPercentileWindowInMilliseconds = 
metricsRollingPercentileWindowInMilliseconds;
+    }
+
+    public Integer getMetricsRollingPercentileWindowBuckets() {
+        return metricsRollingPercentileWindowBuckets;
+    }
+
+    public void setMetricsRollingPercentileWindowBuckets(Integer 
metricsRollingPercentileWindowBuckets) {
+        this.metricsRollingPercentileWindowBuckets = 
metricsRollingPercentileWindowBuckets;
+    }
+
+    public Integer getMetricsRollingStatisticalWindowInMilliseconds() {
+        return metricsRollingStatisticalWindowInMilliseconds;
+    }
+
+    public void setMetricsRollingStatisticalWindowInMilliseconds(Integer 
metricsRollingStatisticalWindowInMilliseconds) {
+        this.metricsRollingStatisticalWindowInMilliseconds = 
metricsRollingStatisticalWindowInMilliseconds;
+    }
+
+    public Integer getMetricsRollingStatisticalWindowBuckets() {
+        return metricsRollingStatisticalWindowBuckets;
+    }
+
+    public void setMetricsRollingStatisticalWindowBuckets(Integer 
metricsRollingStatisticalWindowBuckets) {
+        this.metricsRollingStatisticalWindowBuckets = 
metricsRollingStatisticalWindowBuckets;
+    }
+
+    public Boolean getRequestLogEnabled() {
+        return requestLogEnabled;
+    }
+
+    public void setRequestLogEnabled(Boolean requestLogEnabled) {
+        this.requestLogEnabled = requestLogEnabled;
+    }
+
+    public Integer getCorePoolSize() {
+        return corePoolSize;
+    }
+
+    public void setCorePoolSize(Integer corePoolSize) {
+        this.corePoolSize = corePoolSize;
+    }
+
+    public Integer getMaximumSize() {
+        return maximumSize;
+    }
+
+    public void setMaximumSize(Integer maximumSize) {
+        this.maximumSize = maximumSize;
+    }
+
+    public Integer getKeepAliveTime() {
+        return keepAliveTime;
+    }
+
+    public void setKeepAliveTime(Integer keepAliveTime) {
+        this.keepAliveTime = keepAliveTime;
+    }
+
+    public Integer getMaxQueueSize() {
+        return maxQueueSize;
+    }
+
+    public void setMaxQueueSize(Integer maxQueueSize) {
+        this.maxQueueSize = maxQueueSize;
+    }
+
+    public Integer getQueueSizeRejectionThreshold() {
+        return queueSizeRejectionThreshold;
+    }
+
+    public void setQueueSizeRejectionThreshold(Integer 
queueSizeRejectionThreshold) {
+        this.queueSizeRejectionThreshold = queueSizeRejectionThreshold;
+    }
+
+    public Integer getThreadPoolRollingNumberStatisticalWindowInMilliseconds() 
{
+        return threadPoolRollingNumberStatisticalWindowInMilliseconds;
+    }
+
+    public void 
setThreadPoolRollingNumberStatisticalWindowInMilliseconds(Integer 
threadPoolRollingNumberStatisticalWindowInMilliseconds) {
+        this.threadPoolRollingNumberStatisticalWindowInMilliseconds = 
threadPoolRollingNumberStatisticalWindowInMilliseconds;
+    }
+
+    public Integer getThreadPoolRollingNumberStatisticalWindowBuckets() {
+        return threadPoolRollingNumberStatisticalWindowBuckets;
+    }
+
+    public void setThreadPoolRollingNumberStatisticalWindowBuckets(Integer 
threadPoolRollingNumberStatisticalWindowBuckets) {
+        this.threadPoolRollingNumberStatisticalWindowBuckets = 
threadPoolRollingNumberStatisticalWindowBuckets;
+    }
+
+    public Boolean getAllowMaximumSizeToDivergeFromCoreSize() {
+        return allowMaximumSizeToDivergeFromCoreSize;
+    }
+
+    public void setAllowMaximumSizeToDivergeFromCoreSize(Boolean 
allowMaximumSizeToDivergeFromCoreSize) {
+        this.allowMaximumSizeToDivergeFromCoreSize = 
allowMaximumSizeToDivergeFromCoreSize;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationDefinition.java
 
b/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationDefinition.java
index ae72ec3..b8bd4bc 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationDefinition.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/HystrixConfigurationDefinition.java
@@ -22,7 +22,6 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
@@ -34,106 +33,12 @@ import org.apache.camel.spi.Metadata;
 @Metadata(label = "eip,routing,circuitbreaker")
 @XmlRootElement(name = "hystrixConfiguration")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class HystrixConfigurationDefinition extends IdentifiedType {
+public class HystrixConfigurationDefinition extends HystrixConfigurationCommon 
{
 
     public static final String DEFAULT_GROUP_KEY = "CamelHystrix";
 
     @XmlTransient
     private HystrixDefinition parent;
-    @XmlAttribute @Metadata(defaultValue = "CamelHystrix")
-    private String groupKey;
-    @XmlAttribute @Metadata(defaultValue = "CamelHystrix")
-    private String threadPoolKey;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "true")
-    private Boolean circuitBreakerEnabled;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "50")
-    private Integer circuitBreakerErrorThresholdPercentage;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "true")
-    private Boolean circuitBreakerForceClosed;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "false")
-    private Boolean circuitBreakerForceOpen;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "20")
-    private Integer circuitBreakerRequestVolumeThreshold;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "5000")
-    private Integer circuitBreakerSleepWindowInMilliseconds;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "20")
-    private Integer executionIsolationSemaphoreMaxConcurrentRequests;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "THREAD", enums = 
"THREAD,SEMAPHORE")
-    private String executionIsolationStrategy;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "true")
-    private Boolean executionIsolationThreadInterruptOnTimeout;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "1000")
-    private Integer executionTimeoutInMilliseconds;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "true")
-    private Boolean executionTimeoutEnabled;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "10")
-    private Integer fallbackIsolationSemaphoreMaxConcurrentRequests;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "true")
-    private Boolean fallbackEnabled;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "500")
-    private Integer metricsHealthSnapshotIntervalInMilliseconds;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "10")
-    private Integer metricsRollingPercentileBucketSize;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "true")
-    private Boolean metricsRollingPercentileEnabled;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "10000")
-    private Integer metricsRollingPercentileWindowInMilliseconds;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "6")
-    private Integer metricsRollingPercentileWindowBuckets;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "10000")
-    private Integer metricsRollingStatisticalWindowInMilliseconds;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "10")
-    private Integer metricsRollingStatisticalWindowBuckets;
-    @XmlAttribute
-    @Metadata(label = "command", defaultValue = "true")
-    private Boolean requestLogEnabled;
-
-    // thread-pool
-
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "10")
-    private Integer corePoolSize;
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "10")
-    private Integer maximumSize;
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "1")
-    private Integer keepAliveTime;
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "-1")
-    private Integer maxQueueSize;
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "5")
-    private Integer queueSizeRejectionThreshold;
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "10000")
-    private Integer threadPoolRollingNumberStatisticalWindowInMilliseconds;
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "10")
-    private Integer threadPoolRollingNumberStatisticalWindowBuckets;
-    @XmlAttribute
-    @Metadata(label = "threadpool", defaultValue = "false")
-    private Boolean allowMaximumSizeToDivergeFromCoreSize;
 
     public HystrixConfigurationDefinition() {
     }
@@ -142,257 +47,6 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
         this.parent = parent;
     }
 
-    // Getter/Setter
-    // 
-------------------------------------------------------------------------
-
-    public String getGroupKey() {
-        return groupKey;
-    }
-
-    public void setGroupKey(String groupKey) {
-        this.groupKey = groupKey;
-    }
-
-    public String getThreadPoolKey() {
-        return threadPoolKey;
-    }
-
-    public void setThreadPoolKey(String threadPoolKey) {
-        this.threadPoolKey = threadPoolKey;
-    }
-
-    public Boolean getCircuitBreakerEnabled() {
-        return circuitBreakerEnabled;
-    }
-
-    public void setCircuitBreakerEnabled(Boolean circuitBreakerEnabled) {
-        this.circuitBreakerEnabled = circuitBreakerEnabled;
-    }
-
-    public Integer getCircuitBreakerErrorThresholdPercentage() {
-        return circuitBreakerErrorThresholdPercentage;
-    }
-
-    public void setCircuitBreakerErrorThresholdPercentage(Integer 
circuitBreakerErrorThresholdPercentage) {
-        this.circuitBreakerErrorThresholdPercentage = 
circuitBreakerErrorThresholdPercentage;
-    }
-
-    public Boolean getCircuitBreakerForceClosed() {
-        return circuitBreakerForceClosed;
-    }
-
-    public void setCircuitBreakerForceClosed(Boolean 
circuitBreakerForceClosed) {
-        this.circuitBreakerForceClosed = circuitBreakerForceClosed;
-    }
-
-    public Boolean getCircuitBreakerForceOpen() {
-        return circuitBreakerForceOpen;
-    }
-
-    public void setCircuitBreakerForceOpen(Boolean circuitBreakerForceOpen) {
-        this.circuitBreakerForceOpen = circuitBreakerForceOpen;
-    }
-
-    public Integer getCircuitBreakerRequestVolumeThreshold() {
-        return circuitBreakerRequestVolumeThreshold;
-    }
-
-    public void setCircuitBreakerRequestVolumeThreshold(Integer 
circuitBreakerRequestVolumeThreshold) {
-        this.circuitBreakerRequestVolumeThreshold = 
circuitBreakerRequestVolumeThreshold;
-    }
-
-    public Integer getCircuitBreakerSleepWindowInMilliseconds() {
-        return circuitBreakerSleepWindowInMilliseconds;
-    }
-
-    public void setCircuitBreakerSleepWindowInMilliseconds(Integer 
circuitBreakerSleepWindowInMilliseconds) {
-        this.circuitBreakerSleepWindowInMilliseconds = 
circuitBreakerSleepWindowInMilliseconds;
-    }
-
-    public Integer getExecutionIsolationSemaphoreMaxConcurrentRequests() {
-        return executionIsolationSemaphoreMaxConcurrentRequests;
-    }
-
-    public void setExecutionIsolationSemaphoreMaxConcurrentRequests(Integer 
executionIsolationSemaphoreMaxConcurrentRequests) {
-        this.executionIsolationSemaphoreMaxConcurrentRequests = 
executionIsolationSemaphoreMaxConcurrentRequests;
-    }
-
-    public String getExecutionIsolationStrategy() {
-        return executionIsolationStrategy;
-    }
-
-    public void setExecutionIsolationStrategy(String 
executionIsolationStrategy) {
-        this.executionIsolationStrategy = executionIsolationStrategy;
-    }
-
-    public Boolean getExecutionIsolationThreadInterruptOnTimeout() {
-        return executionIsolationThreadInterruptOnTimeout;
-    }
-
-    public void setExecutionIsolationThreadInterruptOnTimeout(Boolean 
executionIsolationThreadInterruptOnTimeout) {
-        this.executionIsolationThreadInterruptOnTimeout = 
executionIsolationThreadInterruptOnTimeout;
-    }
-
-    public Integer getExecutionTimeoutInMilliseconds() {
-        return executionTimeoutInMilliseconds;
-    }
-
-    public void setExecutionTimeoutInMilliseconds(Integer 
executionTimeoutInMilliseconds) {
-        this.executionTimeoutInMilliseconds = executionTimeoutInMilliseconds;
-    }
-
-    public Boolean getExecutionTimeoutEnabled() {
-        return executionTimeoutEnabled;
-    }
-
-    public void setExecutionTimeoutEnabled(Boolean executionTimeoutEnabled) {
-        this.executionTimeoutEnabled = executionTimeoutEnabled;
-    }
-
-    public Integer getFallbackIsolationSemaphoreMaxConcurrentRequests() {
-        return fallbackIsolationSemaphoreMaxConcurrentRequests;
-    }
-
-    public void setFallbackIsolationSemaphoreMaxConcurrentRequests(Integer 
fallbackIsolationSemaphoreMaxConcurrentRequests) {
-        this.fallbackIsolationSemaphoreMaxConcurrentRequests = 
fallbackIsolationSemaphoreMaxConcurrentRequests;
-    }
-
-    public Boolean getFallbackEnabled() {
-        return fallbackEnabled;
-    }
-
-    public void setFallbackEnabled(Boolean fallbackEnabled) {
-        this.fallbackEnabled = fallbackEnabled;
-    }
-
-    public Integer getMetricsHealthSnapshotIntervalInMilliseconds() {
-        return metricsHealthSnapshotIntervalInMilliseconds;
-    }
-
-    public void setMetricsHealthSnapshotIntervalInMilliseconds(Integer 
metricsHealthSnapshotIntervalInMilliseconds) {
-        this.metricsHealthSnapshotIntervalInMilliseconds = 
metricsHealthSnapshotIntervalInMilliseconds;
-    }
-
-    public Integer getMetricsRollingPercentileBucketSize() {
-        return metricsRollingPercentileBucketSize;
-    }
-
-    public void setMetricsRollingPercentileBucketSize(Integer 
metricsRollingPercentileBucketSize) {
-        this.metricsRollingPercentileBucketSize = 
metricsRollingPercentileBucketSize;
-    }
-
-    public Boolean getMetricsRollingPercentileEnabled() {
-        return metricsRollingPercentileEnabled;
-    }
-
-    public void setMetricsRollingPercentileEnabled(Boolean 
metricsRollingPercentileEnabled) {
-        this.metricsRollingPercentileEnabled = metricsRollingPercentileEnabled;
-    }
-
-    public Integer getMetricsRollingPercentileWindowInMilliseconds() {
-        return metricsRollingPercentileWindowInMilliseconds;
-    }
-
-    public void setMetricsRollingPercentileWindowInMilliseconds(Integer 
metricsRollingPercentileWindowInMilliseconds) {
-        this.metricsRollingPercentileWindowInMilliseconds = 
metricsRollingPercentileWindowInMilliseconds;
-    }
-
-    public Integer getMetricsRollingPercentileWindowBuckets() {
-        return metricsRollingPercentileWindowBuckets;
-    }
-
-    public void setMetricsRollingPercentileWindowBuckets(Integer 
metricsRollingPercentileWindowBuckets) {
-        this.metricsRollingPercentileWindowBuckets = 
metricsRollingPercentileWindowBuckets;
-    }
-
-    public Integer getMetricsRollingStatisticalWindowInMilliseconds() {
-        return metricsRollingStatisticalWindowInMilliseconds;
-    }
-
-    public void setMetricsRollingStatisticalWindowInMilliseconds(Integer 
metricsRollingStatisticalWindowInMilliseconds) {
-        this.metricsRollingStatisticalWindowInMilliseconds = 
metricsRollingStatisticalWindowInMilliseconds;
-    }
-
-    public Integer getMetricsRollingStatisticalWindowBuckets() {
-        return metricsRollingStatisticalWindowBuckets;
-    }
-
-    public void setMetricsRollingStatisticalWindowBuckets(Integer 
metricsRollingStatisticalWindowBuckets) {
-        this.metricsRollingStatisticalWindowBuckets = 
metricsRollingStatisticalWindowBuckets;
-    }
-
-    public Boolean getRequestLogEnabled() {
-        return requestLogEnabled;
-    }
-
-    public void setRequestLogEnabled(Boolean requestLogEnabled) {
-        this.requestLogEnabled = requestLogEnabled;
-    }
-
-    public Integer getCorePoolSize() {
-        return corePoolSize;
-    }
-
-    public void setCorePoolSize(Integer corePoolSize) {
-        this.corePoolSize = corePoolSize;
-    }
-
-    public Integer getMaximumSize() {
-        return maximumSize;
-    }
-
-    public void setMaximumSize(Integer maximumSize) {
-        this.maximumSize = maximumSize;
-    }
-
-    public Integer getKeepAliveTime() {
-        return keepAliveTime;
-    }
-
-    public void setKeepAliveTime(Integer keepAliveTime) {
-        this.keepAliveTime = keepAliveTime;
-    }
-
-    public Integer getMaxQueueSize() {
-        return maxQueueSize;
-    }
-
-    public void setMaxQueueSize(Integer maxQueueSize) {
-        this.maxQueueSize = maxQueueSize;
-    }
-
-    public Integer getQueueSizeRejectionThreshold() {
-        return queueSizeRejectionThreshold;
-    }
-
-    public void setQueueSizeRejectionThreshold(Integer 
queueSizeRejectionThreshold) {
-        this.queueSizeRejectionThreshold = queueSizeRejectionThreshold;
-    }
-
-    public Integer getThreadPoolRollingNumberStatisticalWindowInMilliseconds() 
{
-        return threadPoolRollingNumberStatisticalWindowInMilliseconds;
-    }
-
-    public void 
setThreadPoolRollingNumberStatisticalWindowInMilliseconds(Integer 
threadPoolRollingNumberStatisticalWindowInMilliseconds) {
-        this.threadPoolRollingNumberStatisticalWindowInMilliseconds = 
threadPoolRollingNumberStatisticalWindowInMilliseconds;
-    }
-
-    public Integer getThreadPoolRollingNumberStatisticalWindowBuckets() {
-        return threadPoolRollingNumberStatisticalWindowBuckets;
-    }
-
-    public void setThreadPoolRollingNumberStatisticalWindowBuckets(Integer 
threadPoolRollingNumberStatisticalWindowBuckets) {
-        this.threadPoolRollingNumberStatisticalWindowBuckets = 
threadPoolRollingNumberStatisticalWindowBuckets;
-    }
-
-    public Boolean getAllowMaximumSizeToDivergeFromCoreSize() {
-        return allowMaximumSizeToDivergeFromCoreSize;
-    }
-
-    public void setAllowMaximumSizeToDivergeFromCoreSize(Boolean 
allowMaximumSizeToDivergeFromCoreSize) {
-        this.allowMaximumSizeToDivergeFromCoreSize = 
allowMaximumSizeToDivergeFromCoreSize;
-    }
-
     // Fluent API
     // 
-------------------------------------------------------------------------
 
@@ -419,7 +73,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * should be open/closed, this property results in not even instantiating 
a circuit-breaker.
      */
     public HystrixConfigurationDefinition circuitBreakerEnabled(Boolean 
circuitBreakerEnabled) {
-        this.circuitBreakerEnabled = circuitBreakerEnabled;
+        setCircuitBreakerEnabled(circuitBreakerEnabled);
         return this;
     }
 
@@ -431,7 +85,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * The error percentage this is compared against comes from 
HystrixCommandMetrics.getHealthCounts().
      */
     public HystrixConfigurationDefinition 
circuitBreakerErrorThresholdPercentage(Integer 
circuitBreakerErrorThresholdPercentage) {
-        this.circuitBreakerErrorThresholdPercentage = 
circuitBreakerErrorThresholdPercentage;
+        
setCircuitBreakerErrorThresholdPercentage(circuitBreakerErrorThresholdPercentage);
         return this;
     }
 
@@ -442,7 +96,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * The circuitBreakerForceOpen() property takes precedence so if it set to 
true this property does nothing.
      */
     public HystrixConfigurationDefinition circuitBreakerForceClosed(Boolean 
circuitBreakerForceClosed) {
-        this.circuitBreakerForceClosed = circuitBreakerForceClosed;
+        setCircuitBreakerForceClosed(circuitBreakerForceClosed);
         return this;
     }
 
@@ -452,7 +106,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This property takes precedence over circuitBreakerForceClosed();
      */
     public HystrixConfigurationDefinition circuitBreakerForceOpen(Boolean 
circuitBreakerForceOpen) {
-        this.circuitBreakerForceOpen = circuitBreakerForceOpen;
+        setCircuitBreakerForceOpen(circuitBreakerForceOpen);
         return this;
     }
 
@@ -462,7 +116,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * If below this number the circuit will not trip regardless of error 
percentage.
      */
     public HystrixConfigurationDefinition 
circuitBreakerRequestVolumeThreshold(Integer 
circuitBreakerRequestVolumeThreshold) {
-        this.circuitBreakerRequestVolumeThreshold = 
circuitBreakerRequestVolumeThreshold;
+        
setCircuitBreakerRequestVolumeThreshold(circuitBreakerRequestVolumeThreshold);
         return this;
     }
 
@@ -470,7 +124,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * The time in milliseconds after a HystrixCircuitBreaker trips open that 
it should wait before trying requests again.
      */
     public HystrixConfigurationDefinition 
circuitBreakerSleepWindowInMilliseconds(Integer 
circuitBreakerSleepWindowInMilliseconds) {
-        this.circuitBreakerSleepWindowInMilliseconds = 
circuitBreakerSleepWindowInMilliseconds;
+        
setCircuitBreakerSleepWindowInMilliseconds(circuitBreakerSleepWindowInMilliseconds);
         return this;
     }
 
@@ -480,7 +134,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Applicable only when executionIsolationStrategy == SEMAPHORE.
      */
     public HystrixConfigurationDefinition 
executionIsolationSemaphoreMaxConcurrentRequests(Integer 
executionIsolationSemaphoreMaxConcurrentRequests) {
-        this.executionIsolationSemaphoreMaxConcurrentRequests = 
executionIsolationSemaphoreMaxConcurrentRequests;
+        
setExecutionIsolationSemaphoreMaxConcurrentRequests(executionIsolationSemaphoreMaxConcurrentRequests);
         return this;
     }
 
@@ -492,7 +146,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * If SEMAPHORE then it will be executed on the calling thread and 
concurrent requests limited by the semaphore count.
      */
     public HystrixConfigurationDefinition executionIsolationStrategy(String 
executionIsolationStrategy) {
-        this.executionIsolationStrategy = executionIsolationStrategy;
+        setExecutionIsolationStrategy(executionIsolationStrategy);
         return this;
     }
 
@@ -502,7 +156,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Applicable only when executionIsolationStrategy() == THREAD.
      */
     public HystrixConfigurationDefinition 
executionIsolationThreadInterruptOnTimeout(Boolean 
executionIsolationThreadInterruptOnTimeout) {
-        this.executionIsolationThreadInterruptOnTimeout = 
executionIsolationThreadInterruptOnTimeout;
+        
setExecutionIsolationThreadInterruptOnTimeout(executionIsolationThreadInterruptOnTimeout);
         return this;
     }
 
@@ -513,7 +167,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * If the command is semaphore-isolated and a HystrixObservableCommand, 
that command will get unsubscribed.
      */
     public HystrixConfigurationDefinition 
executionTimeoutInMilliseconds(Integer executionTimeoutInMilliseconds) {
-        this.executionTimeoutInMilliseconds = executionTimeoutInMilliseconds;
+        setExecutionTimeoutInMilliseconds(executionTimeoutInMilliseconds);
         return this;
     }
 
@@ -521,7 +175,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Whether the timeout mechanism is enabled for this command
      */
     public HystrixConfigurationDefinition executionTimeoutEnabled(Boolean 
executionTimeoutEnabled) {
-        this.executionTimeoutEnabled = executionTimeoutEnabled;
+        setExecutionTimeoutEnabled(executionTimeoutEnabled);
         return this;
     }
 
@@ -530,7 +184,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Requests beyond the concurrent limit will fail-fast and not attempt 
retrieving a fallback.
      */
     public HystrixConfigurationDefinition 
fallbackIsolationSemaphoreMaxConcurrentRequests(Integer 
fallbackIsolationSemaphoreMaxConcurrentRequests) {
-        this.fallbackIsolationSemaphoreMaxConcurrentRequests = 
fallbackIsolationSemaphoreMaxConcurrentRequests;
+        
setFallbackIsolationSemaphoreMaxConcurrentRequests(fallbackIsolationSemaphoreMaxConcurrentRequests);
         return this;
     }
 
@@ -538,7 +192,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Whether HystrixCommand.getFallback() should be attempted when failure 
occurs.
      */
     public HystrixConfigurationDefinition fallbackEnabled(Boolean 
fallbackEnabled) {
-        this.fallbackEnabled = fallbackEnabled;
+        setFallbackEnabled(fallbackEnabled);
         return this;
     }
 
@@ -549,7 +203,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * On high-volume circuits the continual calculation of error percentage 
can become CPU intensive thus this controls how often it is calculated.
      */
     public HystrixConfigurationDefinition 
metricsHealthSnapshotIntervalInMilliseconds(Integer 
metricsHealthSnapshotIntervalInMilliseconds) {
-        this.metricsHealthSnapshotIntervalInMilliseconds = 
metricsHealthSnapshotIntervalInMilliseconds;
+        
setMetricsHealthSnapshotIntervalInMilliseconds(metricsHealthSnapshotIntervalInMilliseconds);
         return this;
     }
 
@@ -558,7 +212,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This is passed into HystrixRollingPercentile inside 
HystrixCommandMetrics.
      */
     public HystrixConfigurationDefinition 
metricsRollingPercentileBucketSize(Integer metricsRollingPercentileBucketSize) {
-        this.metricsRollingPercentileBucketSize = 
metricsRollingPercentileBucketSize;
+        
setMetricsRollingPercentileBucketSize(metricsRollingPercentileBucketSize);
         return this;
     }
 
@@ -566,7 +220,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Whether percentile metrics should be captured using 
HystrixRollingPercentile inside HystrixCommandMetrics.
      */
     public HystrixConfigurationDefinition 
metricsRollingPercentileEnabled(Boolean metricsRollingPercentileEnabled) {
-        this.metricsRollingPercentileEnabled = metricsRollingPercentileEnabled;
+        setMetricsRollingPercentileEnabled(metricsRollingPercentileEnabled);
         return this;
     }
 
@@ -575,7 +229,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This is passed into HystrixRollingPercentile inside 
HystrixCommandMetrics.
      */
     public HystrixConfigurationDefinition 
metricsRollingPercentileWindowInMilliseconds(Integer 
metricsRollingPercentileWindowInMilliseconds) {
-        this.metricsRollingPercentileWindowInMilliseconds = 
metricsRollingPercentileWindowInMilliseconds;
+        
setMetricsRollingPercentileWindowInMilliseconds(metricsRollingPercentileWindowInMilliseconds);
         return this;
     }
 
@@ -584,7 +238,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This is passed into HystrixRollingPercentile inside 
HystrixCommandMetrics.
      */
     public HystrixConfigurationDefinition 
metricsRollingPercentileWindowBuckets(Integer 
metricsRollingPercentileWindowBuckets) {
-        this.metricsRollingPercentileWindowBuckets = 
metricsRollingPercentileWindowBuckets;
+        
setMetricsRollingPercentileWindowBuckets(metricsRollingPercentileWindowBuckets);
         return this;
     }
 
@@ -594,7 +248,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * The window is divided into buckets and “rolls” by those increments.
      */
     public HystrixConfigurationDefinition 
metricsRollingStatisticalWindowInMilliseconds(Integer 
metricsRollingStatisticalWindowInMilliseconds) {
-        this.metricsRollingStatisticalWindowInMilliseconds = 
metricsRollingStatisticalWindowInMilliseconds;
+        
setMetricsRollingStatisticalWindowInMilliseconds(metricsRollingStatisticalWindowInMilliseconds);
         return this;
     }
 
@@ -603,7 +257,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This is passed into HystrixRollingNumber inside HystrixCommandMetrics.
      */
     public HystrixConfigurationDefinition 
metricsRollingStatisticalWindowBuckets(Integer 
metricsRollingStatisticalWindowBuckets) {
-        this.metricsRollingStatisticalWindowBuckets = 
metricsRollingStatisticalWindowBuckets;
+        
setMetricsRollingStatisticalWindowBuckets(metricsRollingStatisticalWindowBuckets);
         return this;
     }
 
@@ -611,7 +265,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Whether HystrixCommand execution and events should be logged to 
HystrixRequestLog.
      */
     public HystrixConfigurationDefinition requestLogEnabled(Boolean 
requestLogEnabled) {
-        this.requestLogEnabled = requestLogEnabled;
+        setRequestLogEnabled(requestLogEnabled);
         return this;
     }
 
@@ -619,7 +273,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Core thread-pool size that gets passed to {@link 
java.util.concurrent.ThreadPoolExecutor#setCorePoolSize(int)}
      */
     public HystrixConfigurationDefinition corePoolSize(Integer corePoolSize) {
-        this.corePoolSize = corePoolSize;
+        setCorePoolSize(corePoolSize);
         return this;
     }
 
@@ -627,7 +281,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * Keep-alive time in minutes that gets passed to {@link 
ThreadPoolExecutor#setKeepAliveTime(long, TimeUnit)}
      */
     public HystrixConfigurationDefinition keepAliveTime(Integer keepAliveTime) 
{
-        this.keepAliveTime = keepAliveTime;
+        setKeepAliveTime(keepAliveTime);
         return this;
     }
 
@@ -638,17 +292,17 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * For that, use queueSizeRejectionThreshold().
      */
     public HystrixConfigurationDefinition maxQueueSize(Integer maxQueueSize) {
-        this.maxQueueSize = maxQueueSize;
+        setMaxQueueSize(maxQueueSize);
         return this;
     }
-    
+
     /**
      * Maximum thread-pool size that gets passed to {@link 
ThreadPoolExecutor#setMaximumPoolSize(int)}.
      * This is the maximum amount of concurrency that can be supported without 
starting to reject HystrixCommands.
      * Please note that this setting only takes effect if you also set 
allowMaximumSizeToDivergeFromCoreSize
      */
     public HystrixConfigurationDefinition maximumSize(Integer maximumSize) {
-        this.maximumSize = maximumSize;
+        setMaximumSize(maximumSize);
         return this;
     }
 
@@ -661,7 +315,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This is used by HystrixCommand when queuing a thread for execution.
      */
     public HystrixConfigurationDefinition queueSizeRejectionThreshold(Integer 
queueSizeRejectionThreshold) {
-        this.queueSizeRejectionThreshold = queueSizeRejectionThreshold;
+        setQueueSizeRejectionThreshold(queueSizeRejectionThreshold);
         return this;
     }
 
@@ -670,7 +324,7 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This is passed into HystrixRollingNumber inside each 
HystrixThreadPoolMetrics instance.
      */
     public HystrixConfigurationDefinition 
threadPoolRollingNumberStatisticalWindowInMilliseconds(Integer 
threadPoolRollingNumberStatisticalWindowInMilliseconds) {
-        this.threadPoolRollingNumberStatisticalWindowInMilliseconds = 
threadPoolRollingNumberStatisticalWindowInMilliseconds;
+        
setThreadPoolRollingNumberStatisticalWindowInMilliseconds(threadPoolRollingNumberStatisticalWindowInMilliseconds);
         return this;
     }
 
@@ -679,15 +333,15 @@ public class HystrixConfigurationDefinition extends 
IdentifiedType {
      * This is passed into HystrixRollingNumber inside each 
HystrixThreadPoolMetrics instance.
      */
     public HystrixConfigurationDefinition 
threadPoolRollingNumberStatisticalWindowBuckets(Integer 
threadPoolRollingNumberStatisticalWindowBuckets) {
-        this.threadPoolRollingNumberStatisticalWindowBuckets = 
threadPoolRollingNumberStatisticalWindowBuckets;
+        
setThreadPoolRollingNumberStatisticalWindowBuckets(threadPoolRollingNumberStatisticalWindowBuckets);
         return this;
     }
-    
+
     /**
      * Allows the configuration for maximumSize to take effect. That value can 
then be equal to, or higher, than coreSize
      */
     public HystrixConfigurationDefinition 
allowMaximumSizeToDivergeFromCoreSize(Boolean 
allowMaximumSizeToDivergeFromCoreSize) {
-        this.allowMaximumSizeToDivergeFromCoreSize = 
allowMaximumSizeToDivergeFromCoreSize;
+        
setAllowMaximumSizeToDivergeFromCoreSize(allowMaximumSizeToDivergeFromCoreSize);
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
 
b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
index 72a7701..fecbdc5 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
@@ -827,6 +827,11 @@ public class ServiceCallDefinition extends 
NoOutputDefinition<ServiceCallDefinit
             () -> findByType(camelContext, ServiceDiscovery.class),
             // From registry
             () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_SERVICE_DISCOVERY_ID, ServiceDiscovery.class)
+        ).orElseGet(
+            // Default, that's s little ugly but a load balancer may live 
without
+            // (i.e. the Ribbon one) so let's delegate the null check to the 
actual
+            // impl.
+            () -> null
         );
     }
 
@@ -877,7 +882,8 @@ public class ServiceCallDefinition extends 
NoOutputDefinition<ServiceCallDefinit
             // Check if there is a single instance in the registry
             () -> findByType(camelContext, ServiceFilter.class),
             // From registry
-            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class),
+            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class)
+        ).orElseGet(
             // Default
             () -> new HealthyServiceFilter()
         );
@@ -925,7 +931,8 @@ public class ServiceCallDefinition extends 
NoOutputDefinition<ServiceCallDefinit
             // Check if there is a single instance in the registry
             () -> findByType(camelContext, ServiceChooser.class),
             // From registry
-            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class),
+            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class)
+        ).orElseGet(
             // Default
             () -> new RoundRobinServiceChooser()
         );
@@ -967,7 +974,8 @@ public class ServiceCallDefinition extends 
NoOutputDefinition<ServiceCallDefinit
             // Check if there is a single instance in the registry
             () -> findByType(camelContext, LoadBalancer.class),
             // From registry
-            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_LOAD_BALANCER_ID, LoadBalancer.class),
+            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_LOAD_BALANCER_ID, LoadBalancer.class)
+        ).orElseGet(
             // Default
             () -> new DefaultLoadBalancer()
         );
@@ -1007,7 +1015,8 @@ public class ServiceCallDefinition extends 
NoOutputDefinition<ServiceCallDefinit
             // Default configuration
             () -> retrieveExpression(camelContext, 
this::retrieveDefaultConfig),
             // From registry
-            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID, Expression.class),
+            () -> lookup(camelContext, 
ServiceCallConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID, Expression.class)
+        ).orElseGet(
             // Default
             () -> new DefaultServiceCallExpression()
         );

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/camel-core/src/main/java/org/apache/camel/util/function/Suppliers.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/util/function/Suppliers.java 
b/camel-core/src/main/java/org/apache/camel/util/function/Suppliers.java
index 888de13..88cbe74 100644
--- a/camel-core/src/main/java/org/apache/camel/util/function/Suppliers.java
+++ b/camel-core/src/main/java/org/apache/camel/util/function/Suppliers.java
@@ -17,6 +17,7 @@
 package org.apache.camel.util.function;
 
 import java.util.Objects;
+import java.util.Optional;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Supplier;
 
@@ -41,7 +42,7 @@ public final class Suppliers {
         };
     }
 
-    public static <T> T firstNotNull(ThrowingSupplier<T, Exception>... 
suppliers) throws Exception {
+    public static <T> Optional<T> firstNotNull(ThrowingSupplier<T, 
Exception>... suppliers) throws Exception {
         T answer = null;
 
         for (int i = 0; i < suppliers.length; i++) {
@@ -51,6 +52,6 @@ public final class Suppliers {
             }
         }
 
-        return answer;
+        return Optional.ofNullable(answer);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
index e14132b..ecc74f1 100644
--- 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
+++ 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
@@ -162,6 +162,8 @@ public class CamelContextFactoryBean extends 
AbstractCamelContextFactoryBean<Blu
     private ServiceCallConfigurationDefinition defaultServiceCallConfiguration;
     @XmlElement(name = "serviceCallConfiguration", type = 
ServiceCallConfigurationDefinition.class)
     private List<ServiceCallConfigurationDefinition> serviceCallConfigurations;
+    @XmlElement(name = "defaultHystrixConfiguration")
+    private HystrixConfigurationDefinition defaultHystrixConfiguration;
     @XmlElement(name = "hystrixConfiguration", type = 
HystrixConfigurationDefinition.class)
     private List<HystrixConfigurationDefinition> hystrixConfigurations;
     @XmlElement(name = "routeBuilder")
@@ -670,6 +672,15 @@ public class CamelContextFactoryBean extends 
AbstractCamelContextFactoryBean<Blu
     }
 
     @Override
+    public HystrixConfigurationDefinition getDefaultHystrixConfiguration() {
+        return defaultHystrixConfiguration;
+    }
+
+    public void setDefaultHystrixConfiguration(HystrixConfigurationDefinition 
defaultHystrixConfiguration) {
+        this.defaultHystrixConfiguration = defaultHystrixConfiguration;
+    }
+
+    @Override
     public List<HystrixConfigurationDefinition> getHystrixConfigurations() {
         return hystrixConfigurations;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/components/camel-cdi/src/main/java/org/apache/camel/cdi/xml/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/main/java/org/apache/camel/cdi/xml/CamelContextFactoryBean.java
 
b/components/camel-cdi/src/main/java/org/apache/camel/cdi/xml/CamelContextFactoryBean.java
index 5dbe230..f69e491 100644
--- 
a/components/camel-cdi/src/main/java/org/apache/camel/cdi/xml/CamelContextFactoryBean.java
+++ 
b/components/camel-cdi/src/main/java/org/apache/camel/cdi/xml/CamelContextFactoryBean.java
@@ -179,6 +179,9 @@ public class CamelContextFactoryBean extends 
AbstractCamelContextFactoryBean<Def
     @XmlElement(name = "serviceCallConfiguration", type = 
ServiceCallConfigurationDefinition.class)
     private List<ServiceCallConfigurationDefinition> serviceCallConfigurations;
 
+    @XmlElement(name = "defaultHystrixConfiguration")
+    private HystrixConfigurationDefinition defaultHystrixConfiguration;
+
     @XmlElement(name = "hystrixConfiguration", type = 
HystrixConfigurationDefinition.class)
     private List<HystrixConfigurationDefinition> hystrixConfigurations;
 
@@ -362,6 +365,15 @@ public class CamelContextFactoryBean extends 
AbstractCamelContextFactoryBean<Def
     }
 
     @Override
+    public HystrixConfigurationDefinition getDefaultHystrixConfiguration() {
+        return defaultHystrixConfiguration;
+    }
+
+    public void setDefaultHystrixConfiguration(HystrixConfigurationDefinition 
defaultHystrixConfiguration) {
+        this.defaultHystrixConfiguration = defaultHystrixConfiguration;
+    }
+
+    @Override
     public List<HystrixConfigurationDefinition> getHystrixConfigurations() {
         return hystrixConfigurations;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/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 998d782..912e1af 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
@@ -795,12 +795,14 @@ public abstract class AbstractCamelContextFactoryBean<T 
extends ModelCamelContex
 
     public abstract List<?> getBeans();
 
-    public abstract List<HystrixConfigurationDefinition> 
getHystrixConfigurations();
-
     public abstract ServiceCallConfigurationDefinition 
getDefaultServiceCallConfiguration();
 
     public abstract List<ServiceCallConfigurationDefinition> 
getServiceCallConfigurations();
 
+    public abstract HystrixConfigurationDefinition 
getDefaultHystrixConfiguration();
+
+    public abstract List<HystrixConfigurationDefinition> 
getHystrixConfigurations();
+
     // Implementation methods
     // 
-------------------------------------------------------------------------
 
@@ -888,6 +890,14 @@ public abstract class AbstractCamelContextFactoryBean<T 
extends ModelCamelContex
                 ctx.addServiceCallConfiguration(bean.getId(), bean);
             }
         }
+        if (getDefaultHystrixConfiguration() != null) {
+            ctx.setHystrixConfiguration(getDefaultHystrixConfiguration());
+        }
+        if (getHystrixConfigurations() != null) {
+            for (HystrixConfigurationDefinition bean : 
getHystrixConfigurations()) {
+                ctx.addHystrixConfiguration(bean.getId(), bean);
+            }
+        }
     }
 
     protected void initThreadPoolProfiles(T context) throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/b4d0038a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixConstants.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixConstants.java
 
b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixConstants.java
index 18ac8c0..178af8c 100644
--- 
a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixConstants.java
+++ 
b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixConstants.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.hystrix.processor;
 
 public interface HystrixConstants {
+    String DEFAULT_HYSTRIX_CONFIGURATION_ID = "hystrix-configuration";
 
     // Hystrix EIP response properties
     String HYSTRIX_RESPONSE_SUCCESSFUL_EXECUTION = 
"CamelHystrixSuccessfulExecution";

Reply via email to