You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/11/15 10:31:25 UTC
[camel] 02/04: CAMEL-14182: Make Hystrix EIP general as Circuit
Breaker EIP and allow to plugin other implementations. WIP
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-14182
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b75f6719fc79b7484b5f22a2af0f5156b57211c2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Nov 15 10:08:53 2019 +0100
CAMEL-14182: Make Hystrix EIP general as Circuit Breaker EIP and allow to plugin other implementations. WIP
---
.../hystrix/processor/HystrixProcessorFactory.java | 8 ++---
.../hystrix/processor/HystrixReifier.java | 10 +++---
...{HystrixDefinition => CircuitBreakerDefinition} | 0
.../processor/HystrixBadRequestExceptionTest.java | 2 +-
.../hystrix/processor/HystrixCircuitOpenTest.java | 38 +++++++++++-----------
.../processor/HystrixHierarchicalConfigTest.java | 20 ++++++------
.../processor/HystrixInheritErrorHandlerTest.java | 2 +-
.../hystrix/processor/HystrixManagementTest.java | 6 ++--
.../HystrixRouteConfigMaximumSizeTest.java | 18 +++++-----
.../hystrix/processor/HystrixRouteConfigTest.java | 15 ++++-----
.../processor/HystrixRouteFallbackTest.java | 2 +-
.../HystrixRouteFallbackViaNetworkTest.java | 2 +-
.../hystrix/processor/HystrixRouteOkTest.java | 2 +-
.../hystrix/processor/HystrixTimeoutTest.java | 2 +-
.../processor/HystrixTimeoutWithFallbackTest.java | 2 +-
.../SpringHystrixRouteHierarchicalConfigTest.java | 14 ++++----
.../BlueprintHystrixRouteFallbackTest.xml | 4 +--
.../processor/BlueprintHystrixRouteOkTest.xml | 4 +--
.../SpringHystrixRouteConfigMaximumSizeTest.xml | 4 +--
.../processor/SpringHystrixRouteConfigRefTest.xml | 4 +--
.../processor/SpringHystrixRouteConfigTest.xml | 4 +--
.../processor/SpringHystrixRouteFallbackTest.xml | 4 +--
.../SpringHystrixRouteHierarchicalConfigTest.xml | 4 +--
.../hystrix/processor/SpringHystrixRouteOkTest.xml | 4 +--
24 files changed, 85 insertions(+), 90 deletions(-)
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
index ffa3ad0..0a06abb 100644
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
@@ -18,20 +18,20 @@ package org.apache.camel.component.hystrix.processor;
import org.apache.camel.Processor;
import org.apache.camel.impl.engine.TypedProcessorFactory;
-import org.apache.camel.model.HystrixDefinition;
+import org.apache.camel.model.CircuitBreakerDefinition;
import org.apache.camel.spi.RouteContext;
/**
* To integrate camel-hystrix with the Camel routes using the Hystrix EIP.
*/
-public class HystrixProcessorFactory extends TypedProcessorFactory<HystrixDefinition> {
+public class HystrixProcessorFactory extends TypedProcessorFactory<CircuitBreakerDefinition> {
public HystrixProcessorFactory() {
- super(HystrixDefinition.class);
+ super(CircuitBreakerDefinition.class);
}
@Override
- public Processor doCreateProcessor(RouteContext routeContext, HystrixDefinition definition) throws Exception {
+ public Processor doCreateProcessor(RouteContext routeContext, CircuitBreakerDefinition definition) throws Exception {
return new HystrixReifier(definition).createProcessor(routeContext);
}
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java
index 3efdef4..a263851 100644
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java
@@ -29,8 +29,8 @@ import com.netflix.hystrix.HystrixThreadPoolProperties;
import org.apache.camel.CamelContext;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.Processor;
+import org.apache.camel.model.CircuitBreakerDefinition;
import org.apache.camel.model.HystrixConfigurationDefinition;
-import org.apache.camel.model.HystrixDefinition;
import org.apache.camel.model.Model;
import org.apache.camel.reifier.ProcessorReifier;
import org.apache.camel.spi.BeanIntrospection;
@@ -41,9 +41,9 @@ import org.apache.camel.util.function.Suppliers;
import static org.apache.camel.support.CamelContextHelper.lookup;
import static org.apache.camel.support.CamelContextHelper.mandatoryLookup;
-public class HystrixReifier extends ProcessorReifier<HystrixDefinition> {
+public class HystrixReifier extends ProcessorReifier<CircuitBreakerDefinition> {
- public HystrixReifier(HystrixDefinition definition) {
+ public HystrixReifier(CircuitBreakerDefinition definition) {
super(definition);
}
@@ -223,8 +223,8 @@ public class HystrixReifier extends ProcessorReifier<HystrixDefinition> {
// Extract properties from referenced configuration, the one configured
// on camel context takes the precedence over those in the registry
- if (definition.getHystrixConfigurationRef() != null) {
- final String ref = definition.getHystrixConfigurationRef();
+ if (definition.getConfigurationRef() != null) {
+ final String ref = definition.getConfigurationRef();
loadProperties(camelContext, properties, Suppliers.firstNotNull(
() -> camelContext.getExtension(Model.class).getHystrixConfiguration(ref),
diff --git a/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/HystrixDefinition b/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/CircuitBreakerDefinition
similarity index 100%
rename from components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/HystrixDefinition
rename to components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/CircuitBreakerDefinition
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixBadRequestExceptionTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixBadRequestExceptionTest.java
index 786df98..fc5abaf 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixBadRequestExceptionTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixBadRequestExceptionTest.java
@@ -45,7 +45,7 @@ public class HystrixBadRequestExceptionTest extends CamelTestSupport {
public void configure() throws Exception {
from("direct:start")
.to("log:start")
- .hystrix()
+ .circuitBreaker()
.throwException(new HystrixBadRequestException("Should not fallback"))
.onFallback()
.to("mock:fallback")
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixCircuitOpenTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixCircuitOpenTest.java
index 4c299c8..c362f76 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixCircuitOpenTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixCircuitOpenTest.java
@@ -99,26 +99,26 @@ public class HystrixCircuitOpenTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .hystrix()
- .hystrixConfiguration()
- .executionTimeoutInMilliseconds(100)
- .circuitBreakerRequestVolumeThreshold(REQUEST_VOLUME_THRESHOLD)
- .metricsRollingStatisticalWindowInMilliseconds(1000)
- .circuitBreakerSleepWindowInMilliseconds(2000)
- .end()
- .log("Hystrix processing start: ${threadName}")
- .process(new Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- if (throwException) {
- LOG.info("Will throw exception");
- throw new IOException("Route has failed");
- } else {
- LOG.info("Will NOT throw exception");
+ .circuitBreaker()
+ .hystrixConfiguration()
+ .executionTimeoutInMilliseconds(100)
+ .circuitBreakerRequestVolumeThreshold(REQUEST_VOLUME_THRESHOLD)
+ .metricsRollingStatisticalWindowInMilliseconds(1000)
+ .circuitBreakerSleepWindowInMilliseconds(2000)
+ .end()
+ .log("Hystrix processing start: ${threadName}")
+ .process(new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ if (throwException) {
+ LOG.info("Will throw exception");
+ throw new IOException("Route has failed");
+ } else {
+ LOG.info("Will NOT throw exception");
+ }
}
- }
- })
- .log("Hystrix processing end: ${threadName}")
+ })
+ .log("Hystrix processing end: ${threadName}")
.end()
.log(HYSTRIX_RESPONSE_SHORT_CIRCUITED + " = ${exchangeProperty." + HYSTRIX_RESPONSE_SHORT_CIRCUITED + "}")
.to("mock:result");
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixHierarchicalConfigTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixHierarchicalConfigTest.java
index 5c4c65b..5a73d9c 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixHierarchicalConfigTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixHierarchicalConfigTest.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.hystrix.processor;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.model.CircuitBreakerDefinition;
import org.apache.camel.model.HystrixConfigurationDefinition;
-import org.apache.camel.model.HystrixDefinition;
import org.apache.camel.model.Model;
import org.apache.camel.support.SimpleRegistry;
import org.junit.Assert;
@@ -45,8 +45,8 @@ public class HystrixHierarchicalConfigTest {
registry.bind("ref-hystrix", ref);
final HystrixReifier reifier = new HystrixReifier(
- new HystrixDefinition()
- .hystrixConfiguration("ref-hystrix")
+ new CircuitBreakerDefinition()
+ .configuration("ref-hystrix")
.hystrixConfiguration()
.groupKey("local-conf-group-key")
.requestLogEnabled(false)
@@ -56,7 +56,7 @@ public class HystrixHierarchicalConfigTest {
Assert.assertEquals("local-conf-group-key", config.getGroupKey());
Assert.assertEquals("global-thread-key", config.getThreadPoolKey());
- Assert.assertEquals(new Integer(5), config.getCorePoolSize());
+ Assert.assertEquals(Integer.valueOf(5), config.getCorePoolSize());
}
@Test
@@ -76,8 +76,8 @@ public class HystrixHierarchicalConfigTest {
context.getExtension(Model.class).addHystrixConfiguration("ref-hystrix", ref);
final HystrixReifier reifier = new HystrixReifier(
- new HystrixDefinition()
- .hystrixConfiguration("ref-hystrix")
+ new CircuitBreakerDefinition()
+ .configuration("ref-hystrix")
.hystrixConfiguration()
.groupKey("local-conf-group-key")
.requestLogEnabled(false)
@@ -87,7 +87,7 @@ public class HystrixHierarchicalConfigTest {
Assert.assertEquals("local-conf-group-key", config.getGroupKey());
Assert.assertEquals("global-thread-key", config.getThreadPoolKey());
- Assert.assertEquals(new Integer(5), config.getCorePoolSize());
+ Assert.assertEquals(Integer.valueOf(5), config.getCorePoolSize());
}
@Test
@@ -116,8 +116,8 @@ public class HystrixHierarchicalConfigTest {
registry.bind("ref-hystrix", ref);
final HystrixReifier reifier = new HystrixReifier(
- new HystrixDefinition()
- .hystrixConfiguration("ref-hystrix")
+ new CircuitBreakerDefinition()
+ .configuration("ref-hystrix")
.hystrixConfiguration()
.groupKey("local-conf-group-key")
.requestLogEnabled(false)
@@ -127,6 +127,6 @@ public class HystrixHierarchicalConfigTest {
Assert.assertEquals("local-conf-group-key", config.getGroupKey());
Assert.assertEquals("global-thread-key", config.getThreadPoolKey());
- Assert.assertEquals(new Integer(5), config.getCorePoolSize());
+ Assert.assertEquals(Integer.valueOf(5), config.getCorePoolSize());
}
}
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixInheritErrorHandlerTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixInheritErrorHandlerTest.java
index 561ddc5..f67de0b 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixInheritErrorHandlerTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixInheritErrorHandlerTest.java
@@ -43,7 +43,7 @@ public class HystrixInheritErrorHandlerTest extends CamelTestSupport {
from("direct:start")
.to("log:start")
// turn on Camel's error handler on hystrix so it can do redeliveries
- .hystrix().inheritErrorHandler(true)
+ .circuitBreaker().inheritErrorHandler(true)
.to("mock:a")
.throwException(new IllegalArgumentException("Forced"))
.end()
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java
index f07a33a..ffd95aa 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java
@@ -102,10 +102,10 @@ public class HystrixManagementTest extends CamelTestSupport {
context.addService(stream);
from("direct:start").routeId("start")
- .hystrix().id("myHystrix")
- .to("direct:foo")
+ .circuitBreaker().id("myHystrix")
+ .to("direct:foo")
.onFallback()
- .transform().constant("Fallback message")
+ .transform().constant("Fallback message")
.end()
.to("mock:result");
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigMaximumSizeTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigMaximumSizeTest.java
index ccbba78..d1d286a 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigMaximumSizeTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigMaximumSizeTest.java
@@ -17,8 +17,8 @@
package org.apache.camel.component.hystrix.processor;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.CircuitBreakerDefinition;
import org.apache.camel.model.HystrixConfigurationDefinition;
-import org.apache.camel.model.HystrixDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -41,11 +41,8 @@ public class HystrixRouteConfigMaximumSizeTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:foo")
- .hystrix()
- .hystrixConfiguration().groupKey("test1").metricsHealthSnapshotIntervalInMilliseconds(99999).end()
- .groupKey("test2")
- // ^^^ should only override the groupKey from the HystrixConfigurationDefinition;
- // it should not discard the full HystrixConfigurationDefinition.
+ .circuitBreaker()
+ .hystrixConfiguration().groupKey("test2").metricsHealthSnapshotIntervalInMilliseconds(99999).end()
.to("log:hello")
.end();
@@ -55,9 +52,9 @@ public class HystrixRouteConfigMaximumSizeTest extends CamelTestSupport {
rb.configure();
RouteDefinition route = rb.getRouteCollection().getRoutes().get(0);
- assertEquals(HystrixDefinition.class, route.getOutputs().get(0).getClass());
+ assertEquals(CircuitBreakerDefinition.class, route.getOutputs().get(0).getClass());
- HystrixConfigurationDefinition config = ((HystrixDefinition) route.getOutputs().get(0)).getHystrixConfiguration();
+ HystrixConfigurationDefinition config = ((CircuitBreakerDefinition) route.getOutputs().get(0)).getHystrixConfiguration();
assertEquals("test2", config.getGroupKey());
assertEquals(99999, config.getMetricsHealthSnapshotIntervalInMilliseconds().intValue());
}
@@ -68,9 +65,10 @@ public class HystrixRouteConfigMaximumSizeTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .hystrix()
+ .circuitBreaker()
.hystrixConfiguration().groupKey("myCamelApp").requestLogEnabled(false).corePoolSize(5)
- .maximumSize(15).allowMaximumSizeToDivergeFromCoreSize(true).end()
+ .maximumSize(15).allowMaximumSizeToDivergeFromCoreSize(true)
+ .end()
.to("direct:foo")
.onFallback()
.transform().constant("Fallback message")
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigTest.java
index 84cdf70..1f831ec 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteConfigTest.java
@@ -17,8 +17,8 @@
package org.apache.camel.component.hystrix.processor;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.CircuitBreakerDefinition;
import org.apache.camel.model.HystrixConfigurationDefinition;
-import org.apache.camel.model.HystrixDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -41,11 +41,8 @@ public class HystrixRouteConfigTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:foo")
- .hystrix()
- .hystrixConfiguration().groupKey("test1").metricsHealthSnapshotIntervalInMilliseconds(99999).end()
- .groupKey("test2")
- // ^^^ should only override the groupKey from the HystrixConfigurationDefinition;
- // it should not discard the full HystrixConfigurationDefinition.
+ .circuitBreaker()
+ .hystrixConfiguration().groupKey("test2").metricsHealthSnapshotIntervalInMilliseconds(99999).end()
.to("log:hello")
.end();
@@ -55,9 +52,9 @@ public class HystrixRouteConfigTest extends CamelTestSupport {
rb.configure();
RouteDefinition route = rb.getRouteCollection().getRoutes().get(0);
- assertEquals(HystrixDefinition.class, route.getOutputs().get(0).getClass());
+ assertEquals(CircuitBreakerDefinition.class, route.getOutputs().get(0).getClass());
- HystrixConfigurationDefinition config = ((HystrixDefinition) route.getOutputs().get(0)).getHystrixConfiguration();
+ HystrixConfigurationDefinition config = ((CircuitBreakerDefinition) route.getOutputs().get(0)).getHystrixConfiguration();
assertEquals("test2", config.getGroupKey());
assertEquals(99999, config.getMetricsHealthSnapshotIntervalInMilliseconds().intValue());
}
@@ -69,7 +66,7 @@ public class HystrixRouteConfigTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .hystrix()
+ .circuitBreaker()
.hystrixConfiguration().groupKey("myCamelApp").requestLogEnabled(false).corePoolSize(5).end()
.to("direct:foo")
.onFallback()
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java
index 222542b..ee97733 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java
@@ -40,7 +40,7 @@ public class HystrixRouteFallbackTest extends CamelTestSupport {
public void configure() throws Exception {
from("direct:start")
.to("log:start")
- .hystrix()
+ .circuitBreaker()
.throwException(new IllegalArgumentException("Forced"))
.onFallback()
.transform().constant("Fallback message")
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackViaNetworkTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackViaNetworkTest.java
index 1901bde..7a5e683 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackViaNetworkTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackViaNetworkTest.java
@@ -40,7 +40,7 @@ public class HystrixRouteFallbackViaNetworkTest extends CamelTestSupport {
public void configure() throws Exception {
from("direct:start")
.to("log:start")
- .hystrix()
+ .circuitBreaker()
.throwException(new IllegalArgumentException("Forced"))
.onFallbackViaNetwork()
.transform().constant("Fallback message")
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java
index 6128229..e7faf1c 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java
@@ -39,7 +39,7 @@ public class HystrixRouteOkTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .hystrix()
+ .circuitBreaker()
.to("direct:foo")
.to("log:foo")
.onFallback()
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutTest.java
index 7e78057..ef73ffb 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutTest.java
@@ -68,7 +68,7 @@ public class HystrixTimeoutTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .hystrix()
+ .circuitBreaker()
// use 2 second timeout
.hystrixConfiguration().executionTimeoutInMilliseconds(2000).end()
.log("Hystrix processing start: ${threadName}")
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutWithFallbackTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutWithFallbackTest.java
index dfaae57..7eabc78 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutWithFallbackTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixTimeoutWithFallbackTest.java
@@ -46,7 +46,7 @@ public class HystrixTimeoutWithFallbackTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .hystrix()
+ .circuitBreaker()
// use 2 second timeout
.hystrixConfiguration().executionTimeoutInMilliseconds(2000).end()
.log("Hystrix processing start: ${threadName}")
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.java
index 1d0e32a..efbb76c 100644
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.java
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.camel.component.hystrix.processor;
+import org.apache.camel.model.CircuitBreakerDefinition;
import org.apache.camel.model.HystrixConfigurationDefinition;
-import org.apache.camel.model.HystrixDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Assert;
@@ -36,7 +36,7 @@ public class SpringHystrixRouteHierarchicalConfigTest extends CamelSpringTestSup
@Test
public void testHystrix() throws Exception {
RouteDefinition routeDefinition = context.getRouteDefinition("hystrix-route");
- HystrixDefinition hystrixDefinition = findHystrixDefinition(routeDefinition);
+ CircuitBreakerDefinition hystrixDefinition = findCircuitBreakerDefinition(routeDefinition);
Assert.assertNotNull(hystrixDefinition);
@@ -45,7 +45,7 @@ public class SpringHystrixRouteHierarchicalConfigTest extends CamelSpringTestSup
Assert.assertEquals("local-conf-group-key", config.getGroupKey());
Assert.assertEquals("global-thread-key", config.getThreadPoolKey());
- Assert.assertEquals(new Integer(5), config.getCorePoolSize());
+ Assert.assertEquals(Integer.valueOf(5), config.getCorePoolSize());
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
@@ -58,11 +58,11 @@ public class SpringHystrixRouteHierarchicalConfigTest extends CamelSpringTestSup
// Helper
// **********************************************
- private HystrixDefinition findHystrixDefinition(RouteDefinition routeDefinition) throws Exception {
+ private CircuitBreakerDefinition findCircuitBreakerDefinition(RouteDefinition routeDefinition) throws Exception {
return routeDefinition.getOutputs().stream()
- .filter(HystrixDefinition.class::isInstance)
- .map(HystrixDefinition.class::cast)
+ .filter(CircuitBreakerDefinition.class::isInstance)
+ .map(CircuitBreakerDefinition.class::cast)
.findFirst()
- .orElseThrow(() -> new IllegalStateException("Unable to find a HystrixDefinition"));
+ .orElseThrow(() -> new IllegalStateException("Unable to find a CircuitBreakerDefinition"));
}
}
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteFallbackTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteFallbackTest.xml
index 9833f37..9b1b683 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteFallbackTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteFallbackTest.xml
@@ -25,14 +25,14 @@
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="direct:start"/>
- <hystrix>
+ <circuitBreaker>
<throwException exceptionType="java.lang.IllegalArgumentException" message="Forced"/>
<onFallback>
<transform>
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteOkTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteOkTest.xml
index 160aa8c..4c55703 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteOkTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/BlueprintHystrixRouteOkTest.xml
@@ -25,14 +25,14 @@
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="direct:start"/>
- <hystrix>
+ <circuitBreaker>
<to uri="direct:foo"/>
<onFallback>
<transform>
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigMaximumSizeTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigMaximumSizeTest.xml
index 983cac9..4d0aa78 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigMaximumSizeTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigMaximumSizeTest.xml
@@ -26,7 +26,7 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
- <hystrix>
+ <circuitBreaker>
<hystrixConfiguration groupKey="myCamelApp" requestLogEnabled="false" corePoolSize="5" maximumSize="15" allowMaximumSizeToDivergeFromCoreSize="true"/>
<to uri="direct:foo"/>
<onFallback>
@@ -34,7 +34,7 @@
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigRefTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigRefTest.xml
index 9e98679..40cdf25 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigRefTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigRefTest.xml
@@ -29,14 +29,14 @@
<route>
<from uri="direct:start"/>
- <hystrix hystrixConfigurationRef="hysConfig">
+ <circuitBreaker configurationRef="hysConfig">
<to uri="direct:foo"/>
<onFallback>
<transform>
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigTest.xml
index 134dad7..2c8a9a6 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigTest.xml
@@ -26,7 +26,7 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
- <hystrix>
+ <circuitBreaker>
<hystrixConfiguration groupKey="myCamelApp" requestLogEnabled="false" corePoolSize="5"/>
<to uri="direct:foo"/>
<onFallback>
@@ -34,7 +34,7 @@
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml
index a214043..39dbe97 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml
@@ -26,14 +26,14 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
- <hystrix>
+ <circuitBreaker>
<throwException exceptionType="java.lang.IllegalArgumentException" message="Forced"/>
<onFallback>
<transform>
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.xml
index 61c8a10..2378bf2 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteHierarchicalConfigTest.xml
@@ -30,7 +30,7 @@
<route id="hystrix-route">
<from uri="direct:start"/>
- <hystrix hystrixConfigurationRef="ref-hystrix">
+ <circuitBreaker configurationRef="ref-hystrix">
<hystrixConfiguration groupKey="local-conf-group-key" requestLogEnabled="false"/>
<to uri="direct:foo"/>
<onFallback>
@@ -38,7 +38,7 @@
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml
index f985cca..1e2b139 100644
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml
@@ -26,14 +26,14 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
- <hystrix>
+ <circuitBreaker>
<to uri="direct:foo"/>
<onFallback>
<transform>
<constant>Fallback message</constant>
</transform>
</onFallback>
- </hystrix>
+ </circuitBreaker>
<to uri="mock:result"/>
</route>