This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.11.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.11.x by this push:
new 7b8ec3f CAMEL-16820: Circuit Breaker EIPs - Fix nested splitter
throws UnsupportedOperationException due to route not set on copy exchange.
7b8ec3f is described below
commit 7b8ec3fab04270023cf5658518a50b9999ea61af
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Jul 29 21:26:10 2021 +0200
CAMEL-16820: Circuit Breaker EIPs - Fix nested splitter throws
UnsupportedOperationException due to route not set on copy exchange.
---
.../camel/component/hystrix/processor/HystrixProcessorCommand.java | 6 ++++++
.../microprofile/faulttolerance/FaultToleranceProcessor.java | 6 ++++++
.../apache/camel/component/resilience4j/ResilienceProcessor.java | 6 ++++++
3 files changed, 18 insertions(+)
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 4201850..520b066 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
@@ -27,6 +27,7 @@ import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
+import org.apache.camel.Route;
import org.apache.camel.spi.UnitOfWork;
import org.apache.camel.support.ExchangeHelper;
import org.apache.camel.support.UnitOfWorkHelper;
@@ -127,6 +128,11 @@ public class HystrixProcessorCommand extends
HystrixCommand {
// prepare uow on copy
uow =
copy.getContext().adapt(ExtendedCamelContext.class).getUnitOfWorkFactory().createUnitOfWork(copy);
copy.adapt(ExtendedExchange.class).setUnitOfWork(uow);
+ // the copy must be starting from the route where its copied from
+ Route route = ExchangeHelper.getRoute(exchange);
+ if (route != null) {
+ uow.pushRoute(route);
+ }
try {
// process the processor until its fully done
// (we do not hav any hystrix callback to leverage so we need to
complete all work in this run method)
diff --git
a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
index ee226ac..b29ead5 100644
---
a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
+++
b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
@@ -41,6 +41,7 @@ import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Navigate;
import org.apache.camel.Processor;
+import org.apache.camel.Route;
import org.apache.camel.RuntimeExchangeException;
import org.apache.camel.api.management.ManagedAttribute;
import org.apache.camel.api.management.ManagedResource;
@@ -415,6 +416,11 @@ public class FaultToleranceProcessor extends
AsyncProcessorSupport
// prepare uow on copy
uow =
copy.getContext().adapt(ExtendedCamelContext.class).getUnitOfWorkFactory().createUnitOfWork(copy);
copy.adapt(ExtendedExchange.class).setUnitOfWork(uow);
+ // the copy must be starting from the route where its
copied from
+ Route route = ExchangeHelper.getRoute(exchange);
+ if (route != null) {
+ uow.pushRoute(route);
+ }
}
// process the processor until its fully done
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
index 7853325..29a7320 100644
---
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
@@ -43,6 +43,7 @@ import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Navigate;
import org.apache.camel.Processor;
+import org.apache.camel.Route;
import org.apache.camel.RuntimeExchangeException;
import org.apache.camel.api.management.ManagedAttribute;
import org.apache.camel.api.management.ManagedOperation;
@@ -516,6 +517,11 @@ public class ResilienceProcessor extends
AsyncProcessorSupport
// prepare uow on copy
uow =
copy.getContext().adapt(ExtendedCamelContext.class).getUnitOfWorkFactory().createUnitOfWork(copy);
copy.adapt(ExtendedExchange.class).setUnitOfWork(uow);
+ // the copy must be starting from the route where its copied
from
+ Route route = ExchangeHelper.getRoute(exchange);
+ if (route != null) {
+ uow.pushRoute(route);
+ }
}
// process the processor until its fully done