This is an automated email from the ASF dual-hosted git repository. jamesnetherton 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 8d75554cd81 Upgrade SmallRye Fault Tolerance to 6.4.0 8d75554cd81 is described below commit 8d75554cd8179f3cef863e7868628a28e07d2115 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Tue Jul 23 09:44:37 2024 +0100 Upgrade SmallRye Fault Tolerance to 6.4.0 --- .../faulttolerance/FaultToleranceProcessor.java | 19 +++++++++++++------ .../faulttolerance/FaultToleranceReifier.java | 3 ++- parent/pom.xml | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) 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 765e9faa827..eb61d81717f 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 @@ -72,7 +72,7 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport private static final Logger LOG = LoggerFactory.getLogger(FaultToleranceProcessor.class); - private volatile CircuitBreaker<?> circuitBreaker; + private volatile CircuitBreaker<Exchange> circuitBreaker; private CamelContext camelContext; private String id; private String routeId; @@ -129,7 +129,7 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport return circuitBreaker; } - public void setCircuitBreaker(CircuitBreaker<?> circuitBreaker) { + public void setCircuitBreaker(CircuitBreaker<Exchange> circuitBreaker) { this.circuitBreaker = circuitBreaker; } @@ -258,7 +258,7 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport task = (CircuitBreakerTask) taskFactory.acquire(exchange, callback); // circuit breaker - FaultToleranceStrategy<?> target = circuitBreaker; + FaultToleranceStrategy<Exchange> target = circuitBreaker; // 1. bulkhead if (config.isBulkheadEnabled()) { @@ -274,13 +274,20 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport if (fallbackProcessor != null) { fallbackTask = (CircuitBreakerFallbackTask) fallbackTaskFactory.acquire(exchange, callback); final CircuitBreakerFallbackTask fFallbackTask = fallbackTask; - target = new Fallback(target, "fallback", fallbackContext -> { + target = new Fallback<>(target, "fallback", fallbackContext -> { exchange.setException(fallbackContext.failure); - return fFallbackTask.call(); + try { + return fFallbackTask.call(); + } catch (Exception e) { + if (LOG.isDebugEnabled()) { + LOG.debug("Error occurred processing fallback task", e); + } + } + return null; }, ExceptionDecision.ALWAYS_FAILURE); } - target.apply(new InvocationContext(task)); + target.apply(new InvocationContext<>(task)); } catch (CircuitBreakerOpenException e) { // the circuit breaker triggered a call rejected diff --git a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java index d5b19e986d0..68ff1baf010 100644 --- a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java +++ b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java @@ -24,6 +24,7 @@ import java.util.concurrent.ExecutorService; import io.smallrye.faulttolerance.ExecutorHolder; import io.smallrye.faulttolerance.core.circuit.breaker.CircuitBreaker; import io.smallrye.faulttolerance.core.timer.Timer; +import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Route; import org.apache.camel.model.CircuitBreakerDefinition; @@ -67,7 +68,7 @@ public class FaultToleranceReifier extends ProcessorReifier<CircuitBreakerDefini FaultToleranceProcessor answer = new FaultToleranceProcessor(configuration, processor, fallback); // using any existing circuit breakers? if (config.getCircuitBreaker() != null) { - CircuitBreaker<?> cb = mandatoryLookup(parseString(config.getCircuitBreaker()), CircuitBreaker.class); + CircuitBreaker<Exchange> cb = mandatoryLookup(parseString(config.getCircuitBreaker()), CircuitBreaker.class); answer.setCircuitBreaker(cb); } configureBulkheadExecutorService(answer, config); diff --git a/parent/pom.xml b/parent/pom.xml index e0d90addc2c..0579af9a39e 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -437,7 +437,7 @@ <smack-version>4.3.5</smack-version> <smallrye-config-version>3.8.3</smallrye-config-version> <smallrye-health-version>4.1.0</smallrye-health-version> - <smallrye-fault-tolerance-version>6.3.0</smallrye-fault-tolerance-version> + <smallrye-fault-tolerance-version>6.4.0</smallrye-fault-tolerance-version> <smbj-version>0.13.0</smbj-version> <smooks-version>2.0.0-RC4</smooks-version> <snakeyaml-version>2.2</snakeyaml-version>