This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-24258-ft-cleanup in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4ded8368eed78fa51841f73e087c9ea1cafac07c Author: Claus Ibsen <[email protected]> AuthorDate: Sat Jul 25 13:44:59 2026 +0200 CAMEL-24258: camel-microprofile-fault-tolerance - Remove dead timeoutPoolSize, add live call counters, rename FailureRate to FailureRatio, add reset operation Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../org/apache/camel/catalog/CamelCatalogTest.java | 2 +- .../FaultToleranceConfiguration.java | 11 ----- .../faulttolerance/FaultToleranceConsole.java | 9 ++++- .../faulttolerance/FaultToleranceProcessor.java | 43 ++++++++++++++++---- .../faulttolerance/FaultToleranceReifier.java | 1 - .../FaultToleranceManagementTest.java | 47 +++++++++++++++++----- ...tToleranceRefConfigurationNoReflectionTest.java | 1 - .../FaultToleranceRefConfigurationTest.java | 3 +- ...ToleranceConfigurationDefinitionConfigurer.java | 7 ---- .../camel/model/faultToleranceConfiguration.json | 9 ++--- .../model/FaultToleranceConfigurationCommon.java | 17 -------- .../FaultToleranceConfigurationDefinition.java | 18 --------- .../FaultToleranceConfigurationProperties.java | 21 ---------- .../ROOT/pages/camel-4x-upgrade-guide-4_22.adoc | 18 +++++++++ 14 files changed, 104 insertions(+), 103 deletions(-) diff --git a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java index 3d7bbf3060ea..f5217b7dbe86 100644 --- a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java +++ b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java @@ -1621,7 +1621,7 @@ public class CamelCatalogTest { assertFalse(result.isSuccess()); assertEquals("12x5", result.getInvalidNumber().get("camel.resilience4j.slow-call-rate-threshold")); - text = "camel.faulttolerance.timeoutPoolSize=5"; + text = "camel.faulttolerance.timeoutDuration=5000"; result = catalog.validateConfigurationProperty(text); assertTrue(result.isSuccess()); diff --git a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConfiguration.java b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConfiguration.java index 4f0cdc0dc413..d51d5281a19a 100644 --- a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConfiguration.java +++ b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConfiguration.java @@ -24,7 +24,6 @@ public class FaultToleranceConfiguration { private float failureRatio; private boolean timeoutEnabled; private long timeoutDuration; - private int timeoutPoolSize; private String timeoutExecutorServiceRef; private boolean bulkheadEnabled; private int bulkheadMaxConcurrentCalls; @@ -78,16 +77,6 @@ public class FaultToleranceConfiguration { this.timeoutDuration = timeoutDuration; } - @Deprecated(since = "4.22.0") - public int getTimeoutPoolSize() { - return timeoutPoolSize; - } - - @Deprecated(since = "4.22.0") - public void setTimeoutPoolSize(int timeoutPoolSize) { - this.timeoutPoolSize = timeoutPoolSize; - } - public String getTimeoutExecutorServiceRef() { return timeoutExecutorServiceRef; } diff --git a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConsole.java b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConsole.java index 04a1dbd551c7..6de6228b7119 100644 --- a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConsole.java +++ b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceConsole.java @@ -56,7 +56,11 @@ public class FaultToleranceConsole extends AbstractDevConsole { String id = cb.getId(); String rid = cb.getRouteId(); String state = cb.getCircuitBreakerState(); - sb.append(String.format(" %s/%s: %s%n", rid, id, state)); + long sc = cb.getNumberOfSuccessfulCalls(); + long fc = cb.getNumberOfFailedCalls(); + long npc = cb.getNumberOfNotPermittedCalls(); + sb.append(String.format(" %s/%s: %s (success: %d failure: %d not-permitted: %d)%n", + rid, id, state, sc, fc, npc)); } return sb.toString(); @@ -84,6 +88,9 @@ public class FaultToleranceConsole extends AbstractDevConsole { jo.put("id", cb.getId()); jo.put("routeId", cb.getRouteId()); jo.put("state", cb.getCircuitBreakerState()); + jo.put("successfulCalls", cb.getNumberOfSuccessfulCalls()); + jo.put("failedCalls", cb.getNumberOfFailedCalls()); + jo.put("notPermittedCalls", cb.getNumberOfNotPermittedCalls()); list.add(jo); } root.put("circuitBreakers", list); 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 4124d80d8785..f1360fa5256c 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 @@ -22,6 +22,7 @@ import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; import io.smallrye.faulttolerance.api.CircuitBreakerMaintenance; import io.smallrye.faulttolerance.api.CircuitBreakerState; @@ -38,6 +39,7 @@ import org.apache.camel.RuntimeExchangeException; import org.apache.camel.Suspendable; import org.apache.camel.Traceable; import org.apache.camel.api.management.ManagedAttribute; +import org.apache.camel.api.management.ManagedOperation; import org.apache.camel.api.management.ManagedResource; import org.apache.camel.processor.BaseProcessorSupport; import org.apache.camel.processor.PooledExchangeTask; @@ -80,6 +82,9 @@ public class FaultToleranceProcessor extends BaseProcessorSupport private PooledExchangeTaskFactory fallbackTaskFactory; private TypedGuard.Builder<Exchange> typedGuardBuilder; private TypedGuard<Exchange> typedGuard; + private final AtomicLong successfulCalls = new AtomicLong(); + private final AtomicLong failedCalls = new AtomicLong(); + private final AtomicLong notPermittedCalls = new AtomicLong(); public FaultToleranceProcessor( FaultToleranceConfiguration config, @@ -155,7 +160,7 @@ public class FaultToleranceProcessor extends BaseProcessorSupport } @ManagedAttribute(description = "Returns the configured failure ratio threshold (0.0-1.0).") - public float getFailureRate() { + public float getFailureRatio() { return config.getFailureRatio(); } @@ -179,12 +184,6 @@ public class FaultToleranceProcessor extends BaseProcessorSupport return config.getTimeoutDuration(); } - @Deprecated(since = "4.22.0") - @ManagedAttribute(description = "Deprecated: no longer in use since the switch to TypedGuard API (CAMEL-21857)") - public int getTimeoutPoolSize() { - return config.getTimeoutPoolSize(); - } - @ManagedAttribute(description = "Is bulkhead enabled") public boolean isBulkheadEnabled() { return config.isBulkheadEnabled(); @@ -210,6 +209,33 @@ public class FaultToleranceProcessor extends BaseProcessorSupport } } + @ManagedAttribute(description = "Returns the number of successful calls") + public long getNumberOfSuccessfulCalls() { + return successfulCalls.get(); + } + + @ManagedAttribute(description = "Returns the number of failed calls") + public long getNumberOfFailedCalls() { + return failedCalls.get(); + } + + @ManagedAttribute(description = "Returns the number of not permitted calls when the circuit breaker is open") + public long getNumberOfNotPermittedCalls() { + return notPermittedCalls.get(); + } + + @ManagedOperation(description = "Resets the circuit breaker to CLOSED state and clears call counters.") + public void transitionToCloseState() { + try { + CircuitBreakerMaintenance.get().reset(id); + successfulCalls.set(0); + failedCalls.set(0); + notPermittedCalls.set(0); + } catch (Exception e) { + // ignored + } + } + @Override public List<Processor> next() { if (!hasNext()) { @@ -350,6 +376,9 @@ public class FaultToleranceProcessor extends BaseProcessorSupport .failureRatio(config.getFailureRatio()) .requestVolumeThreshold(config.getRequestVolumeThreshold()) .successThreshold(config.getSuccessThreshold()) + .onSuccess(successfulCalls::incrementAndGet) + .onFailure(failedCalls::incrementAndGet) + .onPrevented(notPermittedCalls::incrementAndGet) .done(); if (config.isTimeoutEnabled()) { 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 f7aa9a73f3f0..62cf9bde9a09 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 @@ -93,7 +93,6 @@ public class FaultToleranceReifier extends ProcessorReifier<CircuitBreakerDefini private void configureTimeLimiter(FaultToleranceConfigurationCommon config, FaultToleranceConfiguration target) { target.setTimeoutEnabled(parseBoolean(config.getTimeoutEnabled(), false)); target.setTimeoutDuration(parseDuration(config.getTimeoutDuration(), 1000)); - target.setTimeoutPoolSize(parseInt(config.getTimeoutPoolSize(), 10)); } private void configureBulkhead(FaultToleranceConfigurationCommon config, FaultToleranceConfiguration target) { diff --git a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceManagementTest.java b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceManagementTest.java index 771627f13026..7bd27c6354da 100644 --- a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceManagementTest.java +++ b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceManagementTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -public class FaultToleranceManagementTest extends CamelTestSupport { +class FaultToleranceManagementTest extends CamelTestSupport { @Override protected boolean useJmx() { @@ -38,30 +38,55 @@ public class FaultToleranceManagementTest extends CamelTestSupport { } @Test - public void testFaultTolerance() throws Exception { + void testFaultTolerance() throws Exception { getMockEndpoint("mock:result").expectedBodiesReceived("Bye World"); template.sendBody("direct:start", "Hello World"); MockEndpoint.assertIsSatisfied(context); - // look inside jmx - // get the stats for the route MBeanServer mbeanServer = getMBeanServer(); - - // context name String name = context.getManagementName(); - - // get the object name for the delayer ObjectName on = ObjectName.getInstance("org.apache.camel:context=" + name + ",type=processors,name=\"myFaultTolerance\""); - // should be on start + // configuration attributes String routeId = (String) mbeanServer.getAttribute(on, "RouteId"); assertEquals("start", routeId); - Long num = (Long) mbeanServer.getAttribute(on, "Delay"); - assertEquals("5000", num.toString()); + Long delay = (Long) mbeanServer.getAttribute(on, "Delay"); + assertEquals(5000L, delay); + + Float failureRatio = (Float) mbeanServer.getAttribute(on, "FailureRatio"); + assertEquals(0.5f, failureRatio); + + Integer requestVolumeThreshold = (Integer) mbeanServer.getAttribute(on, "RequestVolumeThreshold"); + assertEquals(20, requestVolumeThreshold); + + Integer successThreshold = (Integer) mbeanServer.getAttribute(on, "SuccessThreshold"); + assertEquals(1, successThreshold); + + String state = (String) mbeanServer.getAttribute(on, "CircuitBreakerState"); + assertEquals("CLOSED", state); + + // live call counters (one successful call was made above) + Long successfulCalls = (Long) mbeanServer.getAttribute(on, "NumberOfSuccessfulCalls"); + assertEquals(1L, successfulCalls); + + Long failedCalls = (Long) mbeanServer.getAttribute(on, "NumberOfFailedCalls"); + assertEquals(0L, failedCalls); + + Long notPermittedCalls = (Long) mbeanServer.getAttribute(on, "NumberOfNotPermittedCalls"); + assertEquals(0L, notPermittedCalls); + + // test reset operation + mbeanServer.invoke(on, "transitionToCloseState", null, null); + state = (String) mbeanServer.getAttribute(on, "CircuitBreakerState"); + assertEquals("CLOSED", state); + + // counters should be reset after transitionToCloseState + successfulCalls = (Long) mbeanServer.getAttribute(on, "NumberOfSuccessfulCalls"); + assertEquals(0L, successfulCalls); } @Override diff --git a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationNoReflectionTest.java b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationNoReflectionTest.java index e7c5d202bbb1..4a621184c226 100644 --- a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationNoReflectionTest.java +++ b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationNoReflectionTest.java @@ -42,7 +42,6 @@ public class FaultToleranceRefConfigurationNoReflectionTest extends CamelTestSup bi.resetCounters(); FaultToleranceConfigurationDefinition config = new FaultToleranceConfigurationDefinition(); - config.setTimeoutPoolSize("5"); config.setFailureRatio("25"); config.setRequestVolumeThreshold("10"); config.setDelay("5000"); diff --git a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationTest.java b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationTest.java index 5a5cfbbb3e5f..80c1540fa734 100644 --- a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationTest.java +++ b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRefConfigurationTest.java @@ -45,7 +45,6 @@ public class FaultToleranceRefConfigurationTest extends CamelTestSupport { CamelContext context = super.createCamelContext(); FaultToleranceConfigurationDefinition config = new FaultToleranceConfigurationDefinition(); - config.setTimeoutPoolSize("5"); config.setFailureRatio("25"); config.setRequestVolumeThreshold("10"); config.setDelay("5000"); @@ -90,7 +89,7 @@ public class FaultToleranceRefConfigurationTest extends CamelTestSupport { num = (Long) mbeanServer.getAttribute(on, "TimeoutDuration"); assertEquals("5000", num.toString()); - Float fl = (Float) mbeanServer.getAttribute(on, "FailureRate"); + Float fl = (Float) mbeanServer.getAttribute(on, "FailureRatio"); assertEquals("0.25", fl.toString()); } diff --git a/core/camel-core-model/src/generated/java/org/apache/camel/model/FaultToleranceConfigurationDefinitionConfigurer.java b/core/camel-core-model/src/generated/java/org/apache/camel/model/FaultToleranceConfigurationDefinitionConfigurer.java index d0740956b0dd..792ecd33d348 100644 --- a/core/camel-core-model/src/generated/java/org/apache/camel/model/FaultToleranceConfigurationDefinitionConfigurer.java +++ b/core/camel-core-model/src/generated/java/org/apache/camel/model/FaultToleranceConfigurationDefinitionConfigurer.java @@ -33,7 +33,6 @@ public class FaultToleranceConfigurationDefinitionConfigurer extends org.apache. map.put("ThreadOffloadExecutorService", java.lang.String.class); map.put("TimeoutDuration", java.lang.String.class); map.put("TimeoutEnabled", java.lang.String.class); - map.put("TimeoutPoolSize", java.lang.String.class); map.put("TypedGuard", java.lang.String.class); ALL_OPTIONS = map; } @@ -62,8 +61,6 @@ public class FaultToleranceConfigurationDefinitionConfigurer extends org.apache. case "timeoutDuration": target.setTimeoutDuration(property(camelContext, java.lang.String.class, value)); return true; case "timeoutenabled": case "timeoutEnabled": target.setTimeoutEnabled(property(camelContext, java.lang.String.class, value)); return true; - case "timeoutpoolsize": - case "timeoutPoolSize": target.setTimeoutPoolSize(property(camelContext, java.lang.String.class, value)); return true; case "typedguard": case "typedGuard": target.setTypedGuard(property(camelContext, java.lang.String.class, value)); return true; default: return false; @@ -98,8 +95,6 @@ public class FaultToleranceConfigurationDefinitionConfigurer extends org.apache. case "timeoutDuration": return java.lang.String.class; case "timeoutenabled": case "timeoutEnabled": return java.lang.String.class; - case "timeoutpoolsize": - case "timeoutPoolSize": return java.lang.String.class; case "typedguard": case "typedGuard": return java.lang.String.class; default: return null; @@ -130,8 +125,6 @@ public class FaultToleranceConfigurationDefinitionConfigurer extends org.apache. case "timeoutDuration": return target.getTimeoutDuration(); case "timeoutenabled": case "timeoutEnabled": return target.getTimeoutEnabled(); - case "timeoutpoolsize": - case "timeoutPoolSize": return target.getTimeoutPoolSize(); case "typedguard": case "typedGuard": return target.getTypedGuard(); default: return null; diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/faultToleranceConfiguration.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/faultToleranceConfiguration.json index 2b2bbbd57eb3..821625476d43 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/faultToleranceConfiguration.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/faultToleranceConfiguration.json @@ -20,10 +20,9 @@ "failureRatio": { "index": 5, "kind": "attribute", "displayName": "Failure Ratio", "group": "common", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 50, "description": "Configures the failure rate threshold in percentage. If the failure rate is equal or greater than the threshold the CircuitBreaker transitions to open and starts short-circuiting calls." }, "timeoutEnabled": { "index": 6, "kind": "attribute", "displayName": "Timeout Enabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether timeout is enabled or not on the circuit breaker." }, "timeoutDuration": { "index": 7, "kind": "attribute", "displayName": "Timeout Duration", "group": "common", "required": false, "type": "duration", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1000", "description": "Configures the thread execution timeout. Default value is 1 second." }, - "timeoutPoolSize": { "index": 8, "kind": "attribute", "displayName": "Timeout Pool Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": true, "deprecationNote": "No longer in use", "autowired": false, "secret": false, "defaultValue": 10, "description": "Deprecated: no longer in use since the switch to TypedGuard API (CAMEL-21857)." }, - "bulkheadEnabled": { "index": 9, "kind": "attribute", "displayName": "Bulkhead Enabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether bulkhead is enabled or not on the circuit breaker." }, - "bulkheadMaxConcurrentCalls": { "index": 10, "kind": "attribute", "displayName": "Bulkhead Max Concurrent Calls", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "Configures the max amount of concurrent calls the bulkhead will support." }, - "bulkheadWaitingTaskQueue": { "index": 11, "kind": "attribute", "displayName": "Bulkhead Waiting Task Queue", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "Configures the task queue size for holding waiting tasks to be processed by the bulkhead." }, - "threadOffloadExecutorService": { "index": 12, "kind": "attribute", "displayName": "Thread Offload Executor Service", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.concurrent.ExecutorService", "deprecated": false, "autowired": false, "secret": false, "description": "References a custom thread pool to use when offloading a guarded action to another thread." } + "bulkheadEnabled": { "index": 8, "kind": "attribute", "displayName": "Bulkhead Enabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether bulkhead is enabled or not on the circuit breaker." }, + "bulkheadMaxConcurrentCalls": { "index": 9, "kind": "attribute", "displayName": "Bulkhead Max Concurrent Calls", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "Configures the max amount of concurrent calls the bulkhead will support." }, + "bulkheadWaitingTaskQueue": { "index": 10, "kind": "attribute", "displayName": "Bulkhead Waiting Task Queue", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "Configures the task queue size for holding waiting tasks to be processed by the bulkhead." }, + "threadOffloadExecutorService": { "index": 11, "kind": "attribute", "displayName": "Thread Offload Executor Service", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.concurrent.ExecutorService", "deprecated": false, "autowired": false, "secret": false, "description": "References a custom thread pool to use when offloading a guarded action to another thread." } } } diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationCommon.java b/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationCommon.java index aba2576a014b..1a0cee438664 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationCommon.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationCommon.java @@ -56,12 +56,6 @@ public class FaultToleranceConfigurationCommon extends IdentifiedType { description = "Configures the thread execution timeout. Default value is 1 second.") private String timeoutDuration; @XmlAttribute - @Metadata(label = "advanced", defaultValue = "10", javaType = "java.lang.Integer", - description = "Deprecated: no longer in use since the switch to TypedGuard API (CAMEL-21857).", - deprecationNote = "No longer in use") - @Deprecated(since = "4.22.0") - private String timeoutPoolSize; - @XmlAttribute @Metadata(defaultValue = "false", javaType = "java.lang.Boolean", description = "Whether bulkhead is enabled or not on the circuit breaker.") private String bulkheadEnabled; @@ -89,7 +83,6 @@ public class FaultToleranceConfigurationCommon extends IdentifiedType { this.failureRatio = source.failureRatio; this.timeoutEnabled = source.timeoutEnabled; this.timeoutDuration = source.timeoutDuration; - this.timeoutPoolSize = source.timeoutPoolSize; this.bulkheadEnabled = source.bulkheadEnabled; this.bulkheadMaxConcurrentCalls = source.bulkheadMaxConcurrentCalls; this.threadOffloadExecutorService = source.threadOffloadExecutorService; @@ -158,16 +151,6 @@ public class FaultToleranceConfigurationCommon extends IdentifiedType { this.timeoutDuration = timeoutDuration; } - @Deprecated(since = "4.22.0") - public String getTimeoutPoolSize() { - return timeoutPoolSize; - } - - @Deprecated(since = "4.22.0") - public void setTimeoutPoolSize(String timeoutPoolSize) { - this.timeoutPoolSize = timeoutPoolSize; - } - public String getBulkheadEnabled() { return bulkheadEnabled; } diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationDefinition.java index 8abfba6f2c91..71c035d96710 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/FaultToleranceConfigurationDefinition.java @@ -165,24 +165,6 @@ public class FaultToleranceConfigurationDefinition extends FaultToleranceConfigu return this; } - /** - * @deprecated No longer in use since the switch to TypedGuard API (CAMEL-21857). - */ - @Deprecated(since = "4.22.0") - public FaultToleranceConfigurationDefinition timeoutPoolSize(int poolSize) { - setTimeoutPoolSize(Integer.toString(poolSize)); - return this; - } - - /** - * @deprecated No longer in use since the switch to TypedGuard API (CAMEL-21857). - */ - @Deprecated(since = "4.22.0") - public FaultToleranceConfigurationDefinition timeoutPoolSize(String poolSize) { - setTimeoutPoolSize(poolSize); - return this; - } - /** * Whether bulkhead is enabled or not on the circuit breaker. Default is false. */ diff --git a/core/camel-main/src/main/java/org/apache/camel/main/FaultToleranceConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/FaultToleranceConfigurationProperties.java index 7a5b92db91df..3156d84e228e 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/FaultToleranceConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/FaultToleranceConfigurationProperties.java @@ -41,8 +41,6 @@ public class FaultToleranceConfigurationProperties implements BootstrapCloseable private Boolean timeoutEnabled; @Metadata(defaultValue = "1000") private Long timeoutDuration; - @Metadata(defaultValue = "10") - private Integer timeoutPoolSize; @Metadata(defaultValue = "false") private Boolean bulkheadEnabled; @Metadata(defaultValue = "10") @@ -148,17 +146,6 @@ public class FaultToleranceConfigurationProperties implements BootstrapCloseable this.timeoutDuration = timeoutDuration; } - public Integer getTimeoutPoolSize() { - return timeoutPoolSize; - } - - /** - * Configures the pool size of the thread pool when timeout is enabled. Default value is 10. - */ - public void setTimeoutPoolSize(Integer timeoutPoolSize) { - this.timeoutPoolSize = timeoutPoolSize; - } - public Boolean getBulkheadEnabled() { return bulkheadEnabled; } @@ -263,14 +250,6 @@ public class FaultToleranceConfigurationProperties implements BootstrapCloseable return this; } - /** - * Configures the pool size of the thread pool when timeout is enabled. Default value is 10. - */ - public FaultToleranceConfigurationProperties withTimeoutPoolSize(Integer timeoutPoolSize) { - this.timeoutPoolSize = timeoutPoolSize; - return this; - } - /** * Whether bulkhead is enabled or not on the circuit breaker. Default is false. */ diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc index 4fbd5c18e784..5b2deb5465e6 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc @@ -1066,6 +1066,24 @@ The `io.vavr:vavr` and `io.vavr:vavr-match` runtime dependencies have been remov `camel-resilience4j`. The single internal usage of Vavr's `Try` monad has been replaced with a plain try-catch. This eliminates two transitive runtime JARs. No user-facing behavior change. +=== camel-microprofile-fault-tolerance + +The deprecated `timeoutPoolSize` option has been removed from the Fault Tolerance configuration. +This option was never used by SmallRye Fault Tolerance and had no effect. Remove any references +to `timeoutPoolSize` from your configuration. + +The JMX attribute `FailureRate` has been renamed to `FailureRatio` to match the configuration +property name and avoid confusion with live failure rate metrics. + +New JMX attributes have been added for live call monitoring: + +- `NumberOfSuccessfulCalls` - count of successful executions +- `NumberOfFailedCalls` - count of failed executions +- `NumberOfNotPermittedCalls` - count of calls rejected by an open circuit breaker + +A new `transitionToCloseState` JMX operation resets the circuit breaker to CLOSED and clears +the call counters. + === camel-clickhouse (new component) A new `camel-clickhouse` producer component has been added. It integrates with
