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 2017/05/16 10:50:07 UTC
[15/23] camel git commit: Fixing Camel hystrix issue:
https://issues.apache.org/jira/browse/CAMEL-11279
Fixing Camel hystrix issue:
https://issues.apache.org/jira/browse/CAMEL-11279
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/81bb4f46
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/81bb4f46
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/81bb4f46
Branch: refs/heads/camel-2.18.x
Commit: 81bb4f466f3bcf22a445a31b5454f72e6285e7f1
Parents: cf04df3
Author: Anton Krosnev <an...@ocado.com>
Authored: Sun May 14 16:21:43 2017 +0300
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 16 12:30:57 2017 +0200
----------------------------------------------------------------------
.../processor/HystrixProcessorCommand.java | 22 +++++++++-----------
1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/81bb4f46/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
index 511a46e..ab3b696 100644
--- 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
@@ -124,7 +124,8 @@ public class HystrixProcessorCommand extends HystrixCommand {
}
// remember any hystrix execution exception which for example can be triggered by a hystrix timeout
- Throwable cause = getExecutionException();
+ Throwable hystrixExecutionException = getExecutionException();
+ Exception camelExchangeException = copy.getException();
synchronized (lock) {
@@ -143,20 +144,17 @@ public class HystrixProcessorCommand extends HystrixCommand {
// execution exception must take precedence over exchange exception
// because hystrix may have caused this command to fail due timeout or something else
- if (cause != null) {
- exchange.setException(new CamelExchangeException("Hystrix execution exception occurred while processing Exchange", exchange, cause));
+ if (hystrixExecutionException != null) {
+ exchange.setException(new CamelExchangeException("Hystrix execution exception occurred while processing Exchange", exchange, hystrixExecutionException));
}
- // if we have a fallback that can process the exchange in case of an exception
- // then we need to trigger this by throwing an exception so Hystrix will execute the fallback
- // if we don't have a fallback and an exception was thrown then its stored on the exchange
- // and Camel will detect the exception anyway
- if (fallback != null || fallbackCommand != null) {
- if (fallbackEnabled == null || fallbackEnabled && exchange.getException() != null) {
- // throwing exception will cause hystrix to execute fallback
- throw exchange.getException();
- }
+ // in case of an exception in the exchange
+ // we need to trigger this by throwing the exception so Hystrix will execute the fallback
+ // or open the circuit
+ if (hystrixExecutionException == null && camelExchangeException != null) {
+ throw camelExchangeException;
}
+ //}
LOG.debug("Running processor: {} with exchange: {} done", processor, exchange);
return exchange.hasOut() ? exchange.getOut() : exchange.getIn();