This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new d8d5163  CAMEL-16820: Circuit Breaker EIPs - Fix nested splitter 
throws UnsupportedOperationException due to route not set on copy exchange.
d8d5163 is described below

commit d8d51632f110e86ab64e26477047cbbf0b178d2c
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

Reply via email to