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 2016/04/19 14:02:46 UTC
[07/12] camel git commit: CAMEL-9879: Circuit Breaker EIP - That is
using hystrix
CAMEL-9879: Circuit Breaker EIP - That is using hystrix
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/97e65ac4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/97e65ac4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/97e65ac4
Branch: refs/heads/hys
Commit: 97e65ac4c578afd8666adbec2277119d3e2565df
Parents: 55e7391
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Apr 19 11:42:47 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Apr 19 11:42:47 2016 +0200
----------------------------------------------------------------------
.../component/hystrix/HystrixProcessor.java | 112 -------------------
.../hystrix/HystrixProcessorCommand.java | 112 -------------------
.../hystrix/HystrixProcessorFactory.java | 54 ---------
.../hystrix/processor/HystrixProcessor.java | 112 +++++++++++++++++++
.../processor/HystrixProcessorCommand.java | 112 +++++++++++++++++++
.../processor/HystrixProcessorFactory.java | 54 +++++++++
.../org/apache/camel/model/HystrixDefinition | 2 +-
.../hystrix/HystrixRouteFallbackTest.java | 53 ---------
.../component/hystrix/HystrixRouteOkTest.java | 53 ---------
.../hystrix/SpringHystrixRouteFallbackTest.java | 40 -------
.../hystrix/SpringHystrixRouteOkTest.java | 40 -------
.../processor/HystrixRouteFallbackTest.java | 53 +++++++++
.../hystrix/processor/HystrixRouteOkTest.java | 53 +++++++++
.../SpringHystrixRouteFallbackTest.java | 40 +++++++
.../processor/SpringHystrixRouteOkTest.java | 40 +++++++
.../hystrix/SpringHystrixRouteFallbackTest.xml | 44 --------
.../hystrix/SpringHystrixRouteOkTest.xml | 46 --------
.../SpringHystrixRouteFallbackTest.xml | 44 ++++++++
.../processor/SpringHystrixRouteOkTest.xml | 46 ++++++++
19 files changed, 555 insertions(+), 555 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessor.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessor.java
deleted file mode 100644
index 22d48af..0000000
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessor.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.hystrix;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.netflix.hystrix.HystrixCommandGroupKey;
-import org.apache.camel.AsyncCallback;
-import org.apache.camel.AsyncProcessor;
-import org.apache.camel.Exchange;
-import org.apache.camel.Navigate;
-import org.apache.camel.Processor;
-import org.apache.camel.spi.IdAware;
-import org.apache.camel.support.ServiceSupport;
-import org.apache.camel.util.AsyncProcessorConverterHelper;
-import org.apache.camel.util.AsyncProcessorHelper;
-
-/**
- * Implementation of the Hystrix EIP.
- */
-public class HystrixProcessor extends ServiceSupport implements AsyncProcessor, Navigate<Processor>, org.apache.camel.Traceable, IdAware {
-
- private String id;
- private final AsyncProcessor processor;
- private final AsyncProcessor fallback;
-
- public HystrixProcessor(String id, Processor processor, Processor fallback) {
- this.id = id;
- this.processor = AsyncProcessorConverterHelper.convert(processor);
- this.fallback = AsyncProcessorConverterHelper.convert(fallback);
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public String getTraceLabel() {
- return "hystrix";
- }
-
- @Override
- public List<Processor> next() {
- if (!hasNext()) {
- return null;
- }
- List<Processor> answer = new ArrayList<Processor>();
- answer.add(processor);
- if (fallback != null) {
- answer.add(fallback);
- }
- return answer;
- }
-
- @Override
- public boolean hasNext() {
- return true;
- }
-
- @Override
- public void process(Exchange exchange) throws Exception {
- AsyncProcessorHelper.process(this, exchange);
- }
-
- @Override
- public boolean process(Exchange exchange, AsyncCallback callback) {
- HystrixCommandGroupKey key = HystrixCommandGroupKey.Factory.asKey(id);
- HystrixProcessorCommand command = new HystrixProcessorCommand(key, exchange, callback, processor, fallback);
- try {
- command.queue();
- } catch (Throwable e) {
- // error adding to queue, so set as error and we are done
- exchange.setException(e);
- callback.done(true);
- return true;
- }
-
- return false;
- }
-
- @Override
- protected void doStart() throws Exception {
- // noop
- }
-
- @Override
- protected void doStop() throws Exception {
- // noop
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorCommand.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorCommand.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorCommand.java
deleted file mode 100644
index 1eec854..0000000
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorCommand.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.hystrix;
-
-import com.netflix.hystrix.HystrixCommand;
-import com.netflix.hystrix.HystrixCommandGroupKey;
-import org.apache.camel.AsyncCallback;
-import org.apache.camel.AsyncProcessor;
-import org.apache.camel.Exchange;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Hystrix Command for the Camel Hystrix EIP.
- */
-public class HystrixProcessorCommand extends HystrixCommand<Exchange> {
-
- private static final Logger LOG = LoggerFactory.getLogger(HystrixProcessorCommand.class);
- private final Exchange exchange;
- private final AsyncCallback callback;
- private final AsyncProcessor processor;
- private final AsyncProcessor fallback;
-
- public HystrixProcessorCommand(HystrixCommandGroupKey group, Exchange exchange, AsyncCallback callback,
- AsyncProcessor processor, AsyncProcessor fallback) {
- super(group);
- this.exchange = exchange;
- this.callback = callback;
- this.processor = processor;
- this.fallback = fallback;
- }
-
- @Override
- protected Exchange getFallback() {
- // only run fallback if there was an exception
- Exception exception = exchange.getException();
- if (exception == null) {
- return exchange;
- }
-
- try {
- if (fallback != null) {
- LOG.debug("Error occurred processing. Will now run fallback. Exception class: {} message: {}.", exception.getClass().getName(), exception.getMessage());
- // 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, exception);
- 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);
- fallback.process(exchange, callback);
- } catch (Exception e) {
- exchange.setException(e);
- }
- }
- } finally {
- LOG.debug("Running fallback: {} with exchange: {} done", fallback, exchange);
- exchange.removeProperty(Exchange.TRY_ROUTE_BLOCK);
- callback.done(false);
- }
-
- return exchange;
- }
-
- @Override
- protected Exchange run() throws Exception {
- LOG.debug("Running processor: {} with exchange: {}", processor, exchange);
-
- // run this as if we run inside try .. catch so there is no regular Camel error handler
- exchange.setProperty(Exchange.TRY_ROUTE_BLOCK, true);
- try {
- processor.process(exchange, callback);
- } catch (Exception e) {
- exchange.setException(e);
- }
-
- // if we failed then throw an exception
- if (exchange.getException() != null) {
- throw exchange.getException();
- }
- // no errors we are done
- try {
- LOG.debug("Running processor: {} with exchange: {} done", processor, exchange);
- exchange.removeProperty(Exchange.TRY_ROUTE_BLOCK);
- callback.done(false);
- } catch (Throwable e) {
- exchange.setException(e);
- }
-
- return exchange;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorFactory.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorFactory.java
deleted file mode 100644
index 5d4cf99..0000000
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/HystrixProcessorFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.hystrix;
-
-import org.apache.camel.Processor;
-import org.apache.camel.model.HystrixDefinition;
-import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.spi.ProcessorFactory;
-import org.apache.camel.spi.RouteContext;
-
-/**
- * To integrate camel-hystrix with the Camel routes using the Hystrix EIP.
- */
-public class HystrixProcessorFactory implements ProcessorFactory {
-
- @Override
- public Processor createChildProcessor(RouteContext routeContext, ProcessorDefinition<?> definition, boolean mandatory) throws Exception {
- // not in use
- return null;
- }
-
- @Override
- public Processor createProcessor(RouteContext routeContext, ProcessorDefinition<?> definition) throws Exception {
- if (definition instanceof HystrixDefinition) {
- HystrixDefinition cb = (HystrixDefinition) definition;
- String id = cb.idOrCreate(routeContext.getCamelContext().getNodeIdFactory());
-
- // create the regular processor
- Processor processor = cb.createChildProcessor(routeContext, true);
- Processor fallback = null;
- if (cb.getFallback() != null) {
- fallback = cb.getFallback().createProcessor(routeContext);
- }
-
- return new HystrixProcessor(id, processor, fallback);
- } else {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java
new file mode 100644
index 0000000..c3b272d
--- /dev/null
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java
@@ -0,0 +1,112 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.hystrix.processor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.netflix.hystrix.HystrixCommandGroupKey;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.Exchange;
+import org.apache.camel.Navigate;
+import org.apache.camel.Processor;
+import org.apache.camel.spi.IdAware;
+import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
+import org.apache.camel.util.AsyncProcessorHelper;
+
+/**
+ * Implementation of the Hystrix EIP.
+ */
+public class HystrixProcessor extends ServiceSupport implements AsyncProcessor, Navigate<Processor>, org.apache.camel.Traceable, IdAware {
+
+ private String id;
+ private final AsyncProcessor processor;
+ private final AsyncProcessor fallback;
+
+ public HystrixProcessor(String id, Processor processor, Processor fallback) {
+ this.id = id;
+ this.processor = AsyncProcessorConverterHelper.convert(processor);
+ this.fallback = AsyncProcessorConverterHelper.convert(fallback);
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String getTraceLabel() {
+ return "hystrix";
+ }
+
+ @Override
+ public List<Processor> next() {
+ if (!hasNext()) {
+ return null;
+ }
+ List<Processor> answer = new ArrayList<Processor>();
+ answer.add(processor);
+ if (fallback != null) {
+ answer.add(fallback);
+ }
+ return answer;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return true;
+ }
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ AsyncProcessorHelper.process(this, exchange);
+ }
+
+ @Override
+ public boolean process(Exchange exchange, AsyncCallback callback) {
+ HystrixCommandGroupKey key = HystrixCommandGroupKey.Factory.asKey(id);
+ HystrixProcessorCommand command = new HystrixProcessorCommand(key, exchange, callback, processor, fallback);
+ try {
+ command.queue();
+ } catch (Throwable e) {
+ // error adding to queue, so set as error and we are done
+ exchange.setException(e);
+ callback.done(true);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ // noop
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ // noop
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java
new file mode 100644
index 0000000..16c0645
--- /dev/null
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java
@@ -0,0 +1,112 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.hystrix.processor;
+
+import com.netflix.hystrix.HystrixCommand;
+import com.netflix.hystrix.HystrixCommandGroupKey;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.Exchange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Hystrix Command for the Camel Hystrix EIP.
+ */
+public class HystrixProcessorCommand extends HystrixCommand<Exchange> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(HystrixProcessorCommand.class);
+ private final Exchange exchange;
+ private final AsyncCallback callback;
+ private final AsyncProcessor processor;
+ private final AsyncProcessor fallback;
+
+ public HystrixProcessorCommand(HystrixCommandGroupKey group, Exchange exchange, AsyncCallback callback,
+ AsyncProcessor processor, AsyncProcessor fallback) {
+ super(group);
+ this.exchange = exchange;
+ this.callback = callback;
+ this.processor = processor;
+ this.fallback = fallback;
+ }
+
+ @Override
+ protected Exchange getFallback() {
+ // only run fallback if there was an exception
+ Exception exception = exchange.getException();
+ if (exception == null) {
+ return exchange;
+ }
+
+ try {
+ if (fallback != null) {
+ LOG.debug("Error occurred processing. Will now run fallback. Exception class: {} message: {}.", exception.getClass().getName(), exception.getMessage());
+ // 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, exception);
+ 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);
+ fallback.process(exchange, callback);
+ } catch (Exception e) {
+ exchange.setException(e);
+ }
+ }
+ } finally {
+ LOG.debug("Running fallback: {} with exchange: {} done", fallback, exchange);
+ exchange.removeProperty(Exchange.TRY_ROUTE_BLOCK);
+ callback.done(false);
+ }
+
+ return exchange;
+ }
+
+ @Override
+ protected Exchange run() throws Exception {
+ LOG.debug("Running processor: {} with exchange: {}", processor, exchange);
+
+ // run this as if we run inside try .. catch so there is no regular Camel error handler
+ exchange.setProperty(Exchange.TRY_ROUTE_BLOCK, true);
+ try {
+ processor.process(exchange, callback);
+ } catch (Exception e) {
+ exchange.setException(e);
+ }
+
+ // if we failed then throw an exception
+ if (exchange.getException() != null) {
+ throw exchange.getException();
+ }
+ // no errors we are done
+ try {
+ LOG.debug("Running processor: {} with exchange: {} done", processor, exchange);
+ exchange.removeProperty(Exchange.TRY_ROUTE_BLOCK);
+ callback.done(false);
+ } catch (Throwable e) {
+ exchange.setException(e);
+ }
+
+ return exchange;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
new file mode 100644
index 0000000..b6d3a80
--- /dev/null
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.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.hystrix.processor;
+
+import org.apache.camel.Processor;
+import org.apache.camel.model.HystrixDefinition;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.spi.ProcessorFactory;
+import org.apache.camel.spi.RouteContext;
+
+/**
+ * To integrate camel-hystrix with the Camel routes using the Hystrix EIP.
+ */
+public class HystrixProcessorFactory implements ProcessorFactory {
+
+ @Override
+ public Processor createChildProcessor(RouteContext routeContext, ProcessorDefinition<?> definition, boolean mandatory) throws Exception {
+ // not in use
+ return null;
+ }
+
+ @Override
+ public Processor createProcessor(RouteContext routeContext, ProcessorDefinition<?> definition) throws Exception {
+ if (definition instanceof HystrixDefinition) {
+ HystrixDefinition cb = (HystrixDefinition) definition;
+ String id = cb.idOrCreate(routeContext.getCamelContext().getNodeIdFactory());
+
+ // create the regular processor
+ Processor processor = cb.createChildProcessor(routeContext, true);
+ Processor fallback = null;
+ if (cb.getFallback() != null) {
+ fallback = cb.getFallback().createProcessor(routeContext);
+ }
+
+ return new HystrixProcessor(id, processor, fallback);
+ } else {
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/HystrixDefinition
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/HystrixDefinition b/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/HystrixDefinition
index 0e00349..868615a 100644
--- a/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/HystrixDefinition
+++ b/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model/HystrixDefinition
@@ -15,4 +15,4 @@
# limitations under the License.
#
-class=org.apache.camel.component.hystrix.HystrixProcessorFactory
+class=org.apache.camel.component.hystrix.processor.HystrixProcessorFactory
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteFallbackTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteFallbackTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteFallbackTest.java
deleted file mode 100644
index dc7c766..0000000
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteFallbackTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.hystrix;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class HystrixRouteFallbackTest extends CamelTestSupport {
-
- @Test
- public void testHystrix() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
-
- 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")
- .hystrix()
- .to("direct:foo")
- .fallback()
- .transform().constant("Fallback message")
- .end()
- .to("mock:result");
-
- from("direct:foo").errorHandler(noErrorHandler())
- .throwException(new IllegalArgumentException("Forced"));
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteOkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteOkTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteOkTest.java
deleted file mode 100644
index d5a2d5c..0000000
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixRouteOkTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.hystrix;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class HystrixRouteOkTest extends CamelTestSupport {
-
- @Test
- public void testHystrix() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
- 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")
- .hystrix()
- .to("direct:foo")
- .fallback()
- .transform().constant("Fallback message")
- .end()
- .to("mock:result");
-
- from("direct:foo")
- .transform().constant("Bye World");
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.java
deleted file mode 100644
index 263ab47..0000000
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.hystrix;
-
-import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Test;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class SpringHystrixRouteFallbackTest extends CamelSpringTestSupport {
-
- @Override
- protected AbstractApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.xml");
- }
-
- @Test
- public void testHystrix() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.java
deleted file mode 100644
index f459a7f..0000000
--- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.hystrix;
-
-import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Test;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class SpringHystrixRouteOkTest extends CamelSpringTestSupport {
-
- @Override
- protected AbstractApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.xml");
- }
-
- @Test
- public void testHystrix() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java
new file mode 100644
index 0000000..b6cced0
--- /dev/null
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteFallbackTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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.hystrix.processor;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class HystrixRouteFallbackTest extends CamelTestSupport {
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
+
+ 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")
+ .hystrix()
+ .to("direct:foo")
+ .fallback()
+ .transform().constant("Fallback message")
+ .end()
+ .to("mock:result");
+
+ from("direct:foo").errorHandler(noErrorHandler())
+ .throwException(new IllegalArgumentException("Forced"));
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java
new file mode 100644
index 0000000..5d90610
--- /dev/null
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixRouteOkTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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.hystrix.processor;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class HystrixRouteOkTest extends CamelTestSupport {
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+ 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")
+ .hystrix()
+ .to("direct:foo")
+ .fallback()
+ .transform().constant("Fallback message")
+ .end()
+ .to("mock:result");
+
+ from("direct:foo")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.java
new file mode 100644
index 0000000..5f6064b
--- /dev/null
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.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.hystrix.processor;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringHystrixRouteFallbackTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml");
+ }
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Fallback message");
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.java
new file mode 100644
index 0000000..fcffb27
--- /dev/null
+++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.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.hystrix.processor;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringHystrixRouteOkTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml");
+ }
+
+ @Test
+ public void testHystrix() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.xml
deleted file mode 100644
index 441b8b6..0000000
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteFallbackTest.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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"/>
- <hystrix>
- <to uri="direct:foo"/>
- <fallback>
- <transform>
- <constant>Fallback message</constant>
- </transform>
- </fallback>
- </hystrix>
- <to uri="mock:result"/>
- </route>
-
- <route>
- <from uri="direct:foo"/>
- <throwException exceptionType="java.lang.IllegalArgumentException" message="Forced"/>
- </route>
- </camelContext>
-
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.xml
deleted file mode 100644
index 26fdabc..0000000
--- a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/SpringHystrixRouteOkTest.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?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"/>
- <hystrix>
- <to uri="direct:foo"/>
- <fallback>
- <transform>
- <constant>Fallback message</constant>
- </transform>
- </fallback>
- </hystrix>
- <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
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml
new file mode 100644
index 0000000..441b8b6
--- /dev/null
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteFallbackTest.xml
@@ -0,0 +1,44 @@
+<?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"/>
+ <hystrix>
+ <to uri="direct:foo"/>
+ <fallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </fallback>
+ </hystrix>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <throwException exceptionType="java.lang.IllegalArgumentException" message="Forced"/>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/97e65ac4/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml
new file mode 100644
index 0000000..26fdabc
--- /dev/null
+++ b/components/camel-hystrix/src/test/resources/org/apache/camel/component/hystrix/processor/SpringHystrixRouteOkTest.xml
@@ -0,0 +1,46 @@
+<?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"/>
+ <hystrix>
+ <to uri="direct:foo"/>
+ <fallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </fallback>
+ </hystrix>
+ <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