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/18 09:00:43 UTC
[camel] 01/23: CAMEL-13691: camel-resilience4j - WIP
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-13691
in repository https://gitbox.apache.org/repos/asf/camel.git
commit bc9740347c4207110c0ce5582dbd64e695b9074e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Nov 15 13:26:55 2019 +0100
CAMEL-13691: camel-resilience4j - WIP
---
components/camel-resilience4j/pom.xml | 81 ++++++++
.../src/main/docs/resilience4j.adoc | 49 +++++
.../resilience4j/CircuitBreakerConstants.java | 29 +++
.../resilience4j/ResilienceProcessor.java | 165 +++++++++++++++++
.../resilience4j/ResilienceProcessorFactory.java | 38 ++++
.../component/resilience4j/ResilienceReifier.java | 44 +++++
.../apache/camel/model/CircuitBreakerDefinition | 18 ++
.../BlueprintResilienceRouteFallbackTest.java | 40 ++++
.../BlueprintResilienceRouteOkTest.java | 40 ++++
.../resilience4j/HystrixCircuitOpenTest.java | 130 +++++++++++++
.../HystrixInheritErrorHandlerTest.java | 58 ++++++
.../HystrixRouteConfigMaximumSizeTest.java | 86 +++++++++
.../resilience4j/HystrixRouteConfigTest.java | 85 +++++++++
.../HystrixRouteFallbackViaNetworkTest.java | 56 ++++++
.../component/resilience4j/HystrixTimeoutTest.java | 99 ++++++++++
.../HystrixTimeoutWithFallbackTest.java | 85 +++++++++
.../resilience4j/ResilienceRouteFallbackTest.java | 54 ++++++
.../resilience4j/ResilienceRouteOkTest.java | 57 ++++++
.../SpringHystrixRouteConfigMaximumSizeTest.java | 44 +++++
.../SpringHystrixRouteConfigRefTest.java | 44 +++++
.../resilience4j/SpringHystrixRouteConfigTest.java | 44 +++++
.../SpringResilienceRouteFallbackTest.java | 44 +++++
.../resilience4j/SpringResilienceRouteOkTest.java | 44 +++++
.../src/test/resources/log4j2.properties | 28 +++
.../BlueprintResilienceRouteFallbackTest.xml | 41 +++++
.../BlueprintResilienceRouteOkTest.xml | 47 +++++
.../SpringHystrixRouteConfigMaximumSizeTest.xml | 49 +++++
.../SpringHystrixRouteConfigRefTest.xml | 51 ++++++
.../resilience4j/SpringHystrixRouteConfigTest.xml | 49 +++++
.../SpringResilienceRouteFallbackTest.xml | 42 +++++
.../resilience4j/SpringResilienceRouteOkTest.xml | 48 +++++
.../camel-resilience4j-starter/pom.xml | 53 ++++++
.../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++++
.../src/main/resources/META-INF/NOTICE.txt | 11 ++
.../src/main/resources/META-INF/spring.provides | 17 ++
platforms/spring-boot/components-starter/pom.xml | 1 +
36 files changed, 2074 insertions(+)
diff --git a/components/camel-resilience4j/pom.xml b/components/camel-resilience4j/pom.xml
new file mode 100644
index 0000000..fa396b4
--- /dev/null
+++ b/components/camel-resilience4j/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>components</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-resilience4j</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Camel :: Resilience4j</name>
+ <description>Circuit Breaker EIP using Resilience4j</description>
+
+ <properties>
+ <firstVersion>3.0.0</firstVersion>
+ <label>eip,microservice</label>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core-engine</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.github.resilience4j</groupId>
+ <artifactId>resilience4j-circuitbreaker</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-spring</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/components/camel-resilience4j/src/main/docs/resilience4j.adoc b/components/camel-resilience4j/src/main/docs/resilience4j.adoc
new file mode 100644
index 0000000..9afc96e
--- /dev/null
+++ b/components/camel-resilience4j/src/main/docs/resilience4j.adoc
@@ -0,0 +1,49 @@
+= Hystrix Component
+
+*Since Camel 2.18*
+
+The Hystrix component integrates Netflix Hystrix circuit breaker in Camel routes.
+
+For more details see the Hystrix EIP documentation.
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-hystrix</artifactId>
+ <version>x.x.x</version>
+ <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+// spring-boot-auto-configure options: START
+== Spring Boot Auto-Configuration
+
+When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-hystrix-starter</artifactId>
+ <version>x.x.x</version>
+ <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+
+The component supports 3 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *camel.component.hystrix.mapping.enabled* | Enables the automatic mapping of the hystrics metric servlet into the Spring web context. | true | Boolean
+| *camel.component.hystrix.mapping.path* | Endpoint for hystrix metrics servlet. | /hystrix.stream | String
+| *camel.component.hystrix.mapping.servlet-name* | Name of the Hystrix metrics servlet. | HystrixEventStreamServlet | String
+|===
+// spring-boot-auto-configure options: END
diff --git a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/CircuitBreakerConstants.java b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/CircuitBreakerConstants.java
new file mode 100644
index 0000000..0dcbb0c
--- /dev/null
+++ b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/CircuitBreakerConstants.java
@@ -0,0 +1,29 @@
+/*
+ * 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.component.resilience4j;
+
+// TODO: Make these as generic constants so we can use it for hystrix and resilience4j
+
+public interface CircuitBreakerConstants {
+
+ String RESPONSE_SUCCESSFUL_EXECUTION = "CamelCircuitBreakerSuccessfulExecution";
+ String RESPONSE_FROM_FALLBACK = "CamelCircuitBreakerResponseFromFallback";
+ String RESPONSE_SHORT_CIRCUITED = "CamelCircuitBreakerResponseShortCircuited";
+ String RESPONSE_TIMED_OUT = "CamelCircuitBreakerResponseTimedOut";
+ String RESPONSE_REJECTED = "CamelCircuitBreakerResponseRejected";
+
+}
diff --git a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessor.java b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessor.java
new file mode 100644
index 0000000..a9bd0e7
--- /dev/null
+++ b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessor.java
@@ -0,0 +1,165 @@
+/*
+ * 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.component.resilience4j;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import io.github.resilience4j.circuitbreaker.CircuitBreaker;
+import io.vavr.control.Try;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.Navigate;
+import org.apache.camel.Processor;
+import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.spi.IdAware;
+import org.apache.camel.support.AsyncProcessorSupport;
+import org.apache.camel.support.ExchangeHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of Circuit Breaker EIP using resilience4j.
+ */
+@ManagedResource(description = "Managed Resilience Processor")
+public class ResilienceProcessor extends AsyncProcessorSupport implements Navigate<Processor>, org.apache.camel.Traceable, IdAware {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ResilienceProcessor.class);
+
+ private String id;
+ private final Processor processor;
+ private final Processor fallback;
+ private final boolean fallbackViaNetwork;
+
+ public ResilienceProcessor(Processor processor, Processor fallback, boolean fallbackViaNetwork) {
+ this.processor = processor;
+ this.fallback = fallback;
+ this.fallbackViaNetwork = fallbackViaNetwork;
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String getTraceLabel() {
+ return "resilience4j";
+ }
+
+ @Override
+ public List<Processor> next() {
+ if (!hasNext()) {
+ return null;
+ }
+ List<Processor> answer = new ArrayList<>();
+ answer.add(processor);
+ if (fallback != null) {
+ answer.add(fallback);
+ }
+ return answer;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return true;
+ }
+
+ @Override
+ public boolean process(Exchange exchange, AsyncCallback callback) {
+ // run this as if we run inside try .. catch so there is no regular Camel error handler
+ exchange.setProperty(Exchange.TRY_ROUTE_BLOCK, true);
+
+ CircuitBreaker cb = CircuitBreaker.ofDefaults(id);
+
+ Callable task = CircuitBreaker.decorateCallable(cb, () -> {
+ try {
+ LOG.debug("Running processor: {} with exchange: {}", processor, exchange);
+ // prepare a copy of exchange so downstream processors don't cause side-effects if they mutate the exchange
+ // in case timeout processing and continue with the fallback etc
+ Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false, false);
+ // process the processor until its fully done
+ processor.process(copy);
+ if (copy.getException() != null) {
+ exchange.setException(copy.getException());
+ } else {
+ // copy the result as its regarded as success
+ ExchangeHelper.copyResults(exchange, copy);
+ exchange.setProperty(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, true);
+ exchange.setProperty(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, false);
+ }
+ } catch (Throwable e) {
+ exchange.setException(e);
+ }
+ if (exchange.getException() != null) {
+ // throw exception so resilient4j know it was a failure
+ throw exchange.getException();
+ }
+ return null;
+ });
+
+ Try.ofCallable(task)
+ .recover(f -> {
+ if (fallback != null) {
+ // store the last to endpoint as the failure endpoint
+ if (exchange.getProperty(Exchange.FAILURE_ENDPOINT) == null) {
+ exchange.setProperty(Exchange.FAILURE_ENDPOINT, exchange.getProperty(Exchange.TO_ENDPOINT));
+ }
+ // give the rest of the pipeline another chance
+ exchange.setProperty(Exchange.EXCEPTION_HANDLED, true);
+ exchange.setProperty(Exchange.EXCEPTION_CAUGHT, exchange.getException());
+ exchange.removeProperty(Exchange.ROUTE_STOP);
+ exchange.setException(null);
+ // and we should not be regarded as exhausted as we are in a try .. catch block
+ exchange.removeProperty(Exchange.REDELIVERY_EXHAUSTED);
+ // run the fallback processor
+ try {
+ LOG.debug("Running fallback: {} with exchange: {}", fallback, exchange);
+ // process the fallback until its fully done
+ fallback.process(exchange);
+ LOG.debug("Running fallback: {} with exchange: {} done", fallback, exchange);
+ } catch (Exception e) {
+ exchange.setException(e);
+ }
+
+ exchange.setProperty(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, false);
+ exchange.setProperty(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, true);
+ }
+ return null;
+ })
+ .andFinally(() -> callback.done(false)).get();
+
+ return false;
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ // noop
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ // noop
+ }
+
+}
diff --git a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessorFactory.java b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessorFactory.java
new file mode 100644
index 0000000..7da89e8
--- /dev/null
+++ b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessorFactory.java
@@ -0,0 +1,38 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.Processor;
+import org.apache.camel.impl.engine.TypedProcessorFactory;
+import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.spi.RouteContext;
+
+/**
+ * To integrate camel-resilience4j with the Camel routes using the Circuit Breaker EIP.
+ */
+public class ResilienceProcessorFactory extends TypedProcessorFactory<CircuitBreakerDefinition> {
+
+ public ResilienceProcessorFactory() {
+ super(CircuitBreakerDefinition.class);
+ }
+
+ @Override
+ public Processor doCreateProcessor(RouteContext routeContext, CircuitBreakerDefinition definition) throws Exception {
+ return new ResilienceReifier(definition).createProcessor(routeContext);
+ }
+
+}
diff --git a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java
new file mode 100644
index 0000000..1a07f57
--- /dev/null
+++ b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java
@@ -0,0 +1,44 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.Processor;
+import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.reifier.ProcessorReifier;
+import org.apache.camel.spi.RouteContext;
+
+public class ResilienceReifier extends ProcessorReifier<CircuitBreakerDefinition> {
+
+ public ResilienceReifier(CircuitBreakerDefinition definition) {
+ super(definition);
+ }
+
+ @Override
+ public Processor createProcessor(RouteContext routeContext) throws Exception {
+ // create the regular and fallback processors
+ Processor processor = createChildProcessor(routeContext, true);
+ Processor fallback = null;
+ if (definition.getOnFallback() != null) {
+ fallback = ProcessorReifier.reifier(definition.getOnFallback()).createProcessor(routeContext);
+ }
+
+ final String id = getId(definition, routeContext);
+
+ return new ResilienceProcessor(processor, fallback, false);
+ }
+
+}
diff --git a/components/camel-resilience4j/src/main/resources/META-INF/services/org/apache/camel/model/CircuitBreakerDefinition b/components/camel-resilience4j/src/main/resources/META-INF/services/org/apache/camel/model/CircuitBreakerDefinition
new file mode 100644
index 0000000..bab3802
--- /dev/null
+++ b/components/camel-resilience4j/src/main/resources/META-INF/services/org/apache/camel/model/CircuitBreakerDefinition
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+class=org.apache.camel.component.resilience4j.ResilienceProcessorFactory
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/BlueprintResilienceRouteFallbackTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/BlueprintResilienceRouteFallbackTest.java
new file mode 100644
index 0000000..0dac4de
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/BlueprintResilienceRouteFallbackTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.junit.Test;
+
+public class BlueprintResilienceRouteFallbackTest extends CamelBlueprintTestSupport {
+
+ @Override
+ protected String getBlueprintDescriptor() {
+ return "org/apache/camel/component/resilience4j/BlueprintResilienceRouteFallbackTest.xml";
+ }
+
+ @Test
+ public void testResilience() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, false);
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, true);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/BlueprintResilienceRouteOkTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/BlueprintResilienceRouteOkTest.java
new file mode 100644
index 0000000..5f064b3
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/BlueprintResilienceRouteOkTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.junit.Test;
+
+public class BlueprintResilienceRouteOkTest extends CamelBlueprintTestSupport {
+
+ @Override
+ protected String getBlueprintDescriptor() {
+ return "org/apache/camel/component/resilience4j/BlueprintResilienceRouteOkTest.xml";
+ }
+
+ @Test
+ public void testResilience() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, true);
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, false);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixCircuitOpenTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixCircuitOpenTest.java
new file mode 100644
index 0000000..e9e7bcf
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixCircuitOpenTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.component.resilience4j;
+
+import java.io.IOException;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.camel.component.resilience4j.CircuitBreakerConstants.RESPONSE_SHORT_CIRCUITED;
+import static org.apache.camel.component.resilience4j.CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION;
+
+@Ignore
+public class HystrixCircuitOpenTest extends CamelTestSupport {
+ public static final Integer REQUEST_VOLUME_THRESHOLD = 4;
+ private static final Logger LOG = LoggerFactory.getLogger(HystrixCircuitOpenTest.class);
+
+ private HystrixExceptionRoute route = new HystrixExceptionRoute();
+
+ @Test
+ public void testCircuitOpen() throws Exception {
+ LOG.info("testCircuitOpen start");
+ // failing requests
+ route.throwException = true;
+ for (int i = 0; i < 2 * REQUEST_VOLUME_THRESHOLD; i++) {
+ try {
+ template.asyncRequestBody("direct:start", "Request Body");
+ } catch (CamelExecutionException e) {
+ LOG.info(e.toString());
+ }
+ }
+ Thread.sleep(1500);
+
+ resetMocks();
+
+ // notice this can be flaky due timing when using thread sleeps in unit tests
+ getMockEndpoint("mock:result").expectedPropertyReceived(RESPONSE_SHORT_CIRCUITED, true);
+
+ route.throwException = false;
+ try {
+ template.requestBody("direct:start", "Request Body");
+ LOG.info("Instead circuit open expected");
+ } catch (CamelExecutionException e) {
+ LOG.info("Circuit open expected ", e);
+ }
+
+ assertMockEndpointsSatisfied();
+
+ // wait for the circuit to try an other request
+ Thread.sleep(500);
+ for (int i = 0; i < 2 * REQUEST_VOLUME_THRESHOLD; i++) {
+ try {
+ template.requestBody("direct:start", "Request Body");
+ LOG.info("Circuit has closed");
+ } catch (CamelExecutionException e) {
+ Thread.sleep(i * 100);
+ LOG.info("Circuit will be closed soon " + e.toString());
+ }
+ }
+
+ resetMocks();
+
+ getMockEndpoint("mock:result").expectedPropertyReceived(RESPONSE_SHORT_CIRCUITED, false);
+ getMockEndpoint("mock:result").expectedPropertyReceived(RESPONSE_SUCCESSFUL_EXECUTION, true);
+
+ template.requestBody("direct:start", "Request Body");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() throws Exception {
+ return route;
+ }
+
+ class HystrixExceptionRoute extends RouteBuilder {
+ volatile boolean throwException = true;
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .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}")
+ .end()
+ .log(RESPONSE_SHORT_CIRCUITED + " = ${exchangeProperty." + RESPONSE_SHORT_CIRCUITED + "}")
+ .to("mock:result");
+ }
+ }
+}
+
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixInheritErrorHandlerTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixInheritErrorHandlerTest.java
new file mode 100644
index 0000000..d50e02d
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixInheritErrorHandlerTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class HystrixInheritErrorHandlerTest extends CamelTestSupport {
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:a").expectedMessageCount(3 + 1);
+ getMockEndpoint("mock:dead").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedMessageCount(0);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ errorHandler(deadLetterChannel("mock:dead").maximumRedeliveries(3).redeliveryDelay(0));
+
+ from("direct:start")
+ .to("log:start")
+ // turn on Camel's error handler on hystrix so it can do redeliveries
+ .circuitBreaker().inheritErrorHandler(true)
+ .to("mock:a")
+ .throwException(new IllegalArgumentException("Forced"))
+ .end()
+ .to("log:result")
+ .to("mock:result");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteConfigMaximumSizeTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteConfigMaximumSizeTest.java
new file mode 100644
index 0000000..cc225fe
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteConfigMaximumSizeTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.model.HystrixConfigurationDefinition;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class HystrixRouteConfigMaximumSizeTest extends CamelTestSupport {
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testGroupKeyAndThreadPoolKeyConfigFlagsDoNotScrapHystrixConfiguration() throws Exception {
+ // dummy route
+ RouteBuilder rb = new RouteBuilder(context) {
+ @Override
+ public void configure() throws Exception {
+ from("direct:foo")
+ .circuitBreaker()
+ .hystrixConfiguration().groupKey("test2").metricsHealthSnapshotIntervalInMilliseconds(99999).end()
+ .to("log:hello")
+ .end();
+
+ }
+ };
+
+ rb.configure();
+
+ RouteDefinition route = rb.getRouteCollection().getRoutes().get(0);
+ assertEquals(CircuitBreakerDefinition.class, route.getOutputs().get(0).getClass());
+
+ HystrixConfigurationDefinition config = ((CircuitBreakerDefinition) route.getOutputs().get(0)).getHystrixConfiguration();
+ assertEquals("test2", config.getGroupKey());
+ assertEquals(99999, config.getMetricsHealthSnapshotIntervalInMilliseconds().intValue());
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .circuitBreaker()
+ .hystrixConfiguration().groupKey("myCamelApp").requestLogEnabled(false).corePoolSize(5)
+ .maximumSize(15).allowMaximumSizeToDivergeFromCoreSize(true)
+ .end()
+ .to("direct:foo")
+ .onFallback()
+ .transform().constant("Fallback message")
+ .end()
+ .to("mock:result");
+
+ from("direct:foo")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteConfigTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteConfigTest.java
new file mode 100644
index 0000000..dc47a32
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteConfigTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.model.HystrixConfigurationDefinition;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class HystrixRouteConfigTest extends CamelTestSupport {
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testGroupKeyAndThreadPoolKeyConfigFlagsDoNotScrapHystrixConfiguration() throws Exception {
+ // dummy route
+ RouteBuilder rb = new RouteBuilder(context) {
+ @Override
+ public void configure() throws Exception {
+ from("direct:foo")
+ .circuitBreaker()
+ .hystrixConfiguration().groupKey("test2").metricsHealthSnapshotIntervalInMilliseconds(99999).end()
+ .to("log:hello")
+ .end();
+
+ }
+ };
+
+ rb.configure();
+
+ RouteDefinition route = rb.getRouteCollection().getRoutes().get(0);
+ assertEquals(CircuitBreakerDefinition.class, route.getOutputs().get(0).getClass());
+
+ HystrixConfigurationDefinition config = ((CircuitBreakerDefinition) route.getOutputs().get(0)).getHystrixConfiguration();
+ assertEquals("test2", config.getGroupKey());
+ assertEquals(99999, config.getMetricsHealthSnapshotIntervalInMilliseconds().intValue());
+ }
+
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .circuitBreaker()
+ .hystrixConfiguration().groupKey("myCamelApp").requestLogEnabled(false).corePoolSize(5).end()
+ .to("direct:foo")
+ .onFallback()
+ .transform().constant("Fallback message")
+ .end()
+ .to("mock:result");
+
+ from("direct:foo")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteFallbackViaNetworkTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteFallbackViaNetworkTest.java
new file mode 100644
index 0000000..7f2ea21
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixRouteFallbackViaNetworkTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class HystrixRouteFallbackViaNetworkTest extends CamelTestSupport {
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, false);
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, true);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .to("log:start")
+ .circuitBreaker()
+ .throwException(new IllegalArgumentException("Forced"))
+ .onFallbackViaNetwork()
+ .transform().constant("Fallback message")
+ .end()
+ .to("log:result")
+ .to("mock:result");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixTimeoutTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixTimeoutTest.java
new file mode 100644
index 0000000..63abdba
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixTimeoutTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.component.resilience4j;
+
+import java.util.concurrent.TimeoutException;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Hystrix using timeout with Java DSL
+ */
+@Ignore
+public class HystrixTimeoutTest extends CamelTestSupport {
+
+ @Test
+ public void testFast() throws Exception {
+ // this calls the fast route and therefore we get a response
+ Object out = template.requestBody("direct:start", "fast");
+ assertEquals("Fast response", out);
+ }
+
+ @Test
+ public void testSlow() throws Exception {
+ // this calls the slow route and therefore causes a timeout which triggers an exception
+ try {
+ template.requestBody("direct:start", "slow");
+ fail("Should fail due to timeout");
+ } catch (Exception e) {
+ // expected a timeout
+ assertIsInstanceOf(TimeoutException.class, e.getCause().getCause());
+ }
+ }
+
+ @Test
+ public void testSlowLoop() throws Exception {
+ // this calls the slow route and therefore causes a timeout which triggers an exception
+ for (int i = 0; i < 10; i++) {
+ try {
+ log.info(">>> test run " + i + " <<<");
+ template.requestBody("direct:start", "slow");
+ fail("Should fail due to timeout");
+ } catch (Exception e) {
+ // expected a timeout
+ assertIsInstanceOf(TimeoutException.class, e.getCause().getCause());
+ }
+ }
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .circuitBreaker()
+ // use 2 second timeout
+ .hystrixConfiguration().executionTimeoutInMilliseconds(2000).end()
+ .log("Hystrix processing start: ${threadName}")
+ .toD("direct:${body}")
+ .log("Hystrix processing end: ${threadName}")
+ .end()
+ .log("After Hystrix ${body}");
+
+ from("direct:fast")
+ // this is a fast route and takes 1 second to respond
+ .log("Fast processing start: ${threadName}")
+ .delay(1000)
+ .transform().constant("Fast response")
+ .log("Fast processing end: ${threadName}");
+
+ from("direct:slow")
+ // this is a slow route and takes 3 second to respond
+ .log("Slow processing start: ${threadName}")
+ .delay(3000)
+ .transform().constant("Slow response")
+ .log("Slow processing end: ${threadName}");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixTimeoutWithFallbackTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixTimeoutWithFallbackTest.java
new file mode 100644
index 0000000..9a8bb67
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/HystrixTimeoutWithFallbackTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Hystrix using timeout and fallback with Java DSL
+ */
+@Ignore
+public class HystrixTimeoutWithFallbackTest extends CamelTestSupport {
+
+ @Test
+ public void testFast() throws Exception {
+ // this calls the fast route and therefore we get a response
+ Object out = template.requestBody("direct:start", "fast");
+ assertEquals("LAST CHANGE", out);
+ }
+
+ @Test
+ public void testSlow() throws Exception {
+ // this calls the slow route and therefore causes a timeout which triggers the fallback
+ Object out = template.requestBody("direct:start", "slow");
+ assertEquals("LAST CHANGE", out);
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .circuitBreaker()
+ // use 2 second timeout
+ .hystrixConfiguration().executionTimeoutInMilliseconds(2000).end()
+ .log("Hystrix processing start: ${threadName}")
+ .toD("direct:${body}")
+ .log("Hystrix processing end: ${threadName}")
+ .onFallback()
+ // use fallback if there was an exception or timeout
+ .log("Hystrix fallback start: ${threadName}")
+ .transform().constant("Fallback response")
+ .log("Hystrix fallback end: ${threadName}")
+ .end()
+ .log("After Hystrix ${body}")
+ .transform(simple("A CHANGE"))
+ .transform(simple("LAST CHANGE"))
+ .log("End ${body}");
+
+ from("direct:fast")
+ // this is a fast route and takes 1 second to respond
+ .log("Fast processing start: ${threadName}")
+ .delay(1000)
+ .transform().constant("Fast response")
+ .log("Fast processing end: ${threadName}");
+
+ from("direct:slow")
+ // this is a slow route and takes 3 second to respond
+ .log("Slow processing start: ${threadName}")
+ .delay(3000)
+ .transform().constant("Slow response")
+ .log("Slow processing end: ${threadName}");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/ResilienceRouteFallbackTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/ResilienceRouteFallbackTest.java
new file mode 100644
index 0000000..6ae5c36
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/ResilienceRouteFallbackTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class ResilienceRouteFallbackTest extends CamelTestSupport {
+
+ @Test
+ public void testResilience() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, false);
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, true);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .to("log:start")
+ .circuitBreaker()
+ .throwException(new IllegalArgumentException("Forced"))
+ .onFallback()
+ .transform().constant("Fallback message")
+ .end()
+ .to("log:result")
+ .to("mock:result");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/ResilienceRouteOkTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/ResilienceRouteOkTest.java
new file mode 100644
index 0000000..891d504
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/ResilienceRouteOkTest.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.component.resilience4j;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class ResilienceRouteOkTest extends CamelTestSupport {
+
+ @Test
+ public void testResilience() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, true);
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, false);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .circuitBreaker()
+ .to("direct:foo")
+ .to("log:foo")
+ .onFallback()
+ .transform().constant("Fallback message")
+ .end()
+ .to("log:result")
+ .to("mock:result");
+
+ from("direct:foo")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigMaximumSizeTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigMaximumSizeTest.java
new file mode 100644
index 0000000..fabd88a
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigMaximumSizeTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+@Ignore
+@DirtiesContext
+public class SpringHystrixRouteConfigMaximumSizeTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigMaximumSizeTest.xml");
+ }
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigRefTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigRefTest.java
new file mode 100644
index 0000000..14eaae3
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigRefTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+@Ignore
+@DirtiesContext
+public class SpringHystrixRouteConfigRefTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigRefTest.xml");
+ }
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigTest.java
new file mode 100644
index 0000000..72ec426
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+@Ignore
+@DirtiesContext
+public class SpringHystrixRouteConfigTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/hystrix/processor/SpringHystrixRouteConfigTest.xml");
+ }
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringResilienceRouteFallbackTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringResilienceRouteFallbackTest.java
new file mode 100644
index 0000000..12792ad
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringResilienceRouteFallbackTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+@DirtiesContext
+public class SpringResilienceRouteFallbackTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/resilience4j/SpringResilienceRouteFallbackTest.xml");
+ }
+
+ @Test
+ public void testResilience() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, false);
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, true);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringResilienceRouteOkTest.java b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringResilienceRouteOkTest.java
new file mode 100644
index 0000000..c305804
--- /dev/null
+++ b/components/camel-resilience4j/src/test/java/org/apache/camel/component/resilience4j/SpringResilienceRouteOkTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.component.resilience4j;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+@DirtiesContext
+public class SpringResilienceRouteOkTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/resilience4j/SpringResilienceRouteOkTest.xml");
+ }
+
+ @Test
+ public void testResilience() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, true);
+ getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, false);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
diff --git a/components/camel-resilience4j/src/test/resources/log4j2.properties b/components/camel-resilience4j/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..3e584b4
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-resilience4j-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
diff --git a/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/BlueprintResilienceRouteFallbackTest.xml b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/BlueprintResilienceRouteFallbackTest.xml
new file mode 100644
index 0000000..9b1b683
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/BlueprintResilienceRouteFallbackTest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="direct:start"/>
+ <circuitBreaker>
+ <throwException exceptionType="java.lang.IllegalArgumentException" message="Forced"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+ </route>
+
+ </camelContext>
+
+</blueprint>
\ No newline at end of file
diff --git a/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/BlueprintResilienceRouteOkTest.xml b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/BlueprintResilienceRouteOkTest.xml
new file mode 100644
index 0000000..4c55703
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/BlueprintResilienceRouteOkTest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="direct:start"/>
+ <circuitBreaker>
+ <to uri="direct:foo"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <transform>
+ <constant>Bye World</constant>
+ </transform>
+ </route>
+ </camelContext>
+
+</blueprint>
\ No newline at end of file
diff --git a/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigMaximumSizeTest.xml b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigMaximumSizeTest.xml
new file mode 100644
index 0000000..4d0aa78
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigMaximumSizeTest.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <circuitBreaker>
+ <hystrixConfiguration groupKey="myCamelApp" requestLogEnabled="false" corePoolSize="5" maximumSize="15" allowMaximumSizeToDivergeFromCoreSize="true"/>
+ <to uri="direct:foo"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <transform>
+ <constant>Bye World</constant>
+ </transform>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigRefTest.xml b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigRefTest.xml
new file mode 100644
index 0000000..40cdf25
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigRefTest.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <hystrixConfiguration id="hysConfig" requestLogEnabled="false" corePoolSize="5"/>
+
+ <route>
+ <from uri="direct:start"/>
+ <circuitBreaker configurationRef="hysConfig">
+ <to uri="direct:foo"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <transform>
+ <constant>Bye World</constant>
+ </transform>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigTest.xml b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigTest.xml
new file mode 100644
index 0000000..2c8a9a6
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringHystrixRouteConfigTest.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <circuitBreaker>
+ <hystrixConfiguration groupKey="myCamelApp" requestLogEnabled="false" corePoolSize="5"/>
+ <to uri="direct:foo"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <transform>
+ <constant>Bye World</constant>
+ </transform>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringResilienceRouteFallbackTest.xml b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringResilienceRouteFallbackTest.xml
new file mode 100644
index 0000000..39dbe97
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringResilienceRouteFallbackTest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <circuitBreaker>
+ <throwException exceptionType="java.lang.IllegalArgumentException" message="Forced"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+ </route>
+
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringResilienceRouteOkTest.xml b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringResilienceRouteOkTest.xml
new file mode 100644
index 0000000..1e2b139
--- /dev/null
+++ b/components/camel-resilience4j/src/test/resources/org/apache/camel/component/resilience4j/SpringResilienceRouteOkTest.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <circuitBreaker>
+ <to uri="direct:foo"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <transform>
+ <constant>Bye World</constant>
+ </transform>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-resilience4j-starter/pom.xml b/platforms/spring-boot/components-starter/camel-resilience4j-starter/pom.xml
new file mode 100644
index 0000000..0782fb2
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-resilience4j-starter/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>components-starter</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>camel-resilience4j-starter</artifactId>
+ <packaging>jar</packaging>
+ <name>Spring-Boot Starter :: Camel :: Resilience4j</name>
+ <description>Spring-Boot Starter for Circuit Breaker EIP using Resilience4j</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-resilience4j</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--START OF GENERATED CODE-->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ </dependency>
+ <!--END OF GENERATED CODE-->
+ </dependencies>
+</project>
diff --git a/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
diff --git a/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
diff --git a/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..213b910
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-resilience4j-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+provides: camel-resilience4j
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index e083e0f..d04c684 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -313,6 +313,7 @@
<module>camel-reactive-streams-starter</module>
<module>camel-reactor-starter</module>
<module>camel-ref-starter</module>
+ <module>camel-resilience4j-starter</module>
<module>camel-rest-starter</module>
<module>camel-rest-swagger-starter</module>
<module>camel-ribbon-starter</module>