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 1661f0b65b30 CAMEL-24258: camel-microprofile-fault-tolerance - Remove
dead timeoutPoolSize, add live call counters, rename FailureRate to
FailureRatio, fix delay default
1661f0b65b30 is described below
commit 1661f0b65b30ffe65dbc95496af02170e8ba9c37
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jul 25 22:32:34 2026 +0200
CAMEL-24258: camel-microprofile-fault-tolerance - Remove dead
timeoutPoolSize, add live call counters, rename FailureRate to FailureRatio,
fix delay default
Remove the dead timeoutPoolSize option (no longer used since the TypedGuard
API
switch in CAMEL-21857), rename getFailureRate() to getFailureRatio() in JMX
and
dev console to match the actual config property name, fix delay default
from 5
to 5000 (milliseconds), add live call counters
(success/failure/not-permitted)
with AtomicLong, and add a transitionToCloseState JMX operation. Regenerate
all
affected schemas, catalog, parsers, and DSL files.
Closes #25111
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../org/apache/camel/catalog/docs/main.adoc | 5 +--
.../main/camel-main-configuration-metadata.json | 3 +-
.../models/faultToleranceConfiguration.json | 9 ++---
.../apache/camel/catalog/schemas/camel-spring.xsd | 9 -----
.../apache/camel/catalog/schemas/camel-xml-io.xsd | 9 -----
.../org/apache/camel/catalog/CamelCatalogTest.java | 2 +-
.../FaultToleranceConfiguration.java | 11 -----
.../faulttolerance/FaultToleranceConsole.java | 11 ++++-
.../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 ---------
.../apache/camel/java/out/JavaDslModelWriter.java | 1 -
...ToleranceConfigurationPropertiesConfigurer.java | 7 ----
.../camel-main-configuration-metadata.json | 3 +-
core/camel-main/src/main/docs/main.adoc | 5 +--
.../FaultToleranceConfigurationProperties.java | 27 ++-----------
.../java/org/apache/camel/xml/in/ModelParser.java | 1 -
.../java/org/apache/camel/xml/out/ModelWriter.java | 1 -
.../org/apache/camel/yaml/out/YamlModelWriter.java | 1 -
.../ROOT/pages/camel-4x-upgrade-guide-4_22.adoc | 18 +++++++++
.../dsl/yaml/deserializers/ModelDeserializers.java | 6 ---
.../resources/schema/camelYamlDsl-canonical.json | 7 ----
.../generated/resources/schema/camelYamlDsl.json | 7 ----
29 files changed, 118 insertions(+), 171 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
index cfd34759d89d..7a4ab4b3e9fc 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/main.adoc
@@ -657,7 +657,7 @@ The camel.metrics supports 16 options, which are listed
below.
=== Fault Tolerance EIP Circuit Breaker configurations
-The camel.faulttolerance supports 12 options, which are listed below.
+The camel.faulttolerance supports 11 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
@@ -665,14 +665,13 @@ The camel.faulttolerance supports 12 options, which are
listed below.
| *camel.faulttolerance.bulkheadEnabled* | Whether bulkhead is enabled or not
on the circuit breaker. Default is false. | false | Boolean
| *camel.faulttolerance.bulkheadMaxConcurrentCalls* | Configures the max
amount of concurrent calls the bulkhead will support. Default value is 10. | 10
| Integer
| *camel.faulttolerance.bulkheadWaitingTaskQueue* | Configures the task queue
size for holding waiting tasks to be processed by the bulkhead. Default value
is 10. | 10 | Integer
-| *camel.faulttolerance.delay* | Control how long the circuit breaker stays
open. The value are in seconds and the default is 5 seconds. | 5 | Long
+| *camel.faulttolerance.delay* | Control how long the circuit breaker stays
open. The default is 5 seconds. | 5000 | Long
| *camel.faulttolerance.failureRatio* | 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. The
threshold must be greater than 0 and not greater than 100. Default value is 50
percentage. | 50 | Integer
| *camel.faulttolerance.requestVolumeThreshold* | Controls the size of the
rolling window used when the circuit breaker is closed Default value is 20. |
20 | Integer
| *camel.faulttolerance.successThreshold* | Controls the number of trial calls
which are allowed when the circuit breaker is half-open Default value is 1. | 1
| Integer
| *camel.faulttolerance.threadOffloadExecutorService* | References a custom
thread pool to use when offloading a guarded action to another thread. | |
String
| *camel.faulttolerance.timeoutDuration* | Configures the thread execution
timeout. Default value is 1000 milliseconds. | 1000 | Long
| *camel.faulttolerance.timeoutEnabled* | Whether timeout is enabled or not on
the circuit breaker. Default is false. | false | Boolean
-| *camel.faulttolerance.timeoutPoolSize* | Configures the pool size of the
thread pool when timeout is enabled. Default value is 10. | 10 | Integer
| *camel.faulttolerance.typedGuard* | Refers to an existing
io.smallrye.faulttolerance.api.TypedGuard instance to lookup and use from the
registry. When using this, then any other TypedGuard circuit breaker options
are not in use. | | String
|===
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index ff6f31dbb39e..0b648bd4ea81 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -267,14 +267,13 @@
{ "name": "camel.faulttolerance.bulkheadEnabled", "required": false,
"description": "Whether bulkhead is enabled or not on the circuit breaker.
Default is false.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"boolean", "javaType": "java.lang.Boolean", "defaultValue": false, "secret":
false },
{ "name": "camel.faulttolerance.bulkheadMaxConcurrentCalls", "required":
false, "description": "Configures the max amount of concurrent calls the
bulkhead will support. Default value is 10.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false
},
{ "name": "camel.faulttolerance.bulkheadWaitingTaskQueue", "required":
false, "description": "Configures the task queue size for holding waiting tasks
to be processed by the bulkhead. Default value is 10.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false
},
- { "name": "camel.faulttolerance.delay", "required": false, "description":
"Control how long the circuit breaker stays open. The value are in seconds and
the default is 5 seconds.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Long", "defaultValue": 5, "secret": false },
+ { "name": "camel.faulttolerance.delay", "required": false, "description":
"Control how long the circuit breaker stays open. The default is 5 seconds.",
"sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties",
"type": "integer", "javaType": "java.lang.Long", "defaultValue": 5000,
"secret": false },
{ "name": "camel.faulttolerance.failureRatio", "required": false,
"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. The threshold must be
greater than 0 and not greater than 100. Default value is 50 percentage.",
"sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties",
"type": "integer", "javaType": "java.lang.Inte [...]
{ "name": "camel.faulttolerance.requestVolumeThreshold", "required":
false, "description": "Controls the size of the rolling window used when the
circuit breaker is closed Default value is 20.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 20, "secret": false
},
{ "name": "camel.faulttolerance.successThreshold", "required": false,
"description": "Controls the number of trial calls which are allowed when the
circuit breaker is half-open Default value is 1.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 1, "secret": false
},
{ "name": "camel.faulttolerance.threadOffloadExecutorService", "required":
false, "description": "References a custom thread pool to use when offloading a
guarded action to another thread.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.faulttolerance.timeoutDuration", "required": false,
"description": "Configures the thread execution timeout. Default value is 1000
milliseconds.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Long", "defaultValue": 1000, "secret": false
},
{ "name": "camel.faulttolerance.timeoutEnabled", "required": false,
"description": "Whether timeout is enabled or not on the circuit breaker.
Default is false.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"boolean", "javaType": "java.lang.Boolean", "defaultValue": false, "secret":
false },
- { "name": "camel.faulttolerance.timeoutPoolSize", "required": false,
"description": "Configures the pool size of the thread pool when timeout is
enabled. Default value is 10.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false
},
{ "name": "camel.faulttolerance.typedGuard", "required": false,
"description": "Refers to an existing io.smallrye.faulttolerance.api.TypedGuard
instance to lookup and use from the registry. When using this, then any other
TypedGuard circuit breaker options are not in use.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.health.consumersEnabled", "required": false,
"description": "Whether consumers health check is enabled", "sourceType":
"org.apache.camel.main.HealthConfigurationProperties", "type": "boolean",
"javaType": "java.lang.Boolean", "defaultValue": true, "secret": false },
{ "name": "camel.health.enabled", "required": false, "description":
"Whether health check is enabled globally", "sourceType":
"org.apache.camel.main.HealthConfigurationProperties", "type": "boolean",
"javaType": "java.lang.Boolean", "defaultValue": true, "secret": false },
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/faultToleranceConfiguration.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/faultToleranceConfiguration.json
index 2b2bbbd57eb3..821625476d43 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/faultToleranceConfiguration.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/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/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index c9551fd956ad..4b463bb4cf2a 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -4722,15 +4722,6 @@ Whether timeout is enabled or not on the circuit
breaker. Default value: false
<xs:documentation xml:lang="en">
<![CDATA[
Configures the thread execution timeout. Default value is 1 second. Default
value: 1000
-]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="timeoutPoolSize" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">
-<![CDATA[
-Deprecated: Deprecated: no longer in use since the switch to TypedGuard API
(CAMEL-21857). Default value: 10
]]>
</xs:documentation>
</xs:annotation>
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
index ac1f3462415a..10b2c2dea867 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
@@ -3844,15 +3844,6 @@ Whether timeout is enabled or not on the circuit
breaker. Default value: false
<xs:documentation xml:lang="en">
<![CDATA[
Configures the thread execution timeout. Default value is 1 second. Default
value: 1000
-]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="timeoutPoolSize" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">
-<![CDATA[
-Deprecated: Deprecated: no longer in use since the switch to TypedGuard API
(CAMEL-21857). Default value: 10
]]>
</xs:documentation>
</xs:annotation>
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 14f6ce4f96f6..8839a812f0f5 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,10 +88,13 @@ 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());
// configuration
JsonObject config = new JsonObject();
config.put("delay", cb.getDelay());
- config.put("failureRate", cb.getFailureRate());
+ config.put("failureRatio", cb.getFailureRatio());
config.put("requestVolumeThreshold",
cb.getRequestVolumeThreshold());
config.put("successThreshold", cb.getSuccessThreshold());
config.put("bulkheadEnabled", cb.isBulkheadEnabled());
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 a30b45ffcbe4..db261d5d68ac 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.bulkheadWaitingTaskQueue = source.bulkheadWaitingTaskQueue;
@@ -159,16 +152,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-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
index 6c20ee1c85bd..dc001845851a 100644
---
a/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
+++
b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
@@ -1920,7 +1920,6 @@ public class JavaDslModelWriter extends
JavaDslModelWriterSupport {
doWriteAttribute(sb, "failureRatio", def.getFailureRatio(), "50");
doWriteAttribute(sb, "timeoutEnabled", def.getTimeoutEnabled(),
"false");
doWriteAttribute(sb, "timeoutDuration", def.getTimeoutDuration(),
"1000");
- doWriteAttribute(sb, "timeoutPoolSize", def.getTimeoutPoolSize(),
"10");
doWriteAttribute(sb, "bulkheadEnabled", def.getBulkheadEnabled(),
"false");
doWriteAttribute(sb, "bulkheadMaxConcurrentCalls",
def.getBulkheadMaxConcurrentCalls(), "10");
doWriteAttribute(sb, "bulkheadWaitingTaskQueue",
def.getBulkheadWaitingTaskQueue(), "10");
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/FaultToleranceConfigurationPropertiesConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/FaultToleranceConfigurationPropertiesConfigurer.java
index a5702873874c..30f651da7d8d 100644
---
a/core/camel-main/src/generated/java/org/apache/camel/main/FaultToleranceConfigurationPropertiesConfigurer.java
+++
b/core/camel-main/src/generated/java/org/apache/camel/main/FaultToleranceConfigurationPropertiesConfigurer.java
@@ -32,7 +32,6 @@ public class FaultToleranceConfigurationPropertiesConfigurer
extends org.apache.
map.put("ThreadOffloadExecutorService", java.lang.String.class);
map.put("TimeoutDuration", java.lang.Long.class);
map.put("TimeoutEnabled", java.lang.Boolean.class);
- map.put("TimeoutPoolSize", java.lang.Integer.class);
map.put("TypedGuard", java.lang.String.class);
ALL_OPTIONS = map;
}
@@ -60,8 +59,6 @@ public class FaultToleranceConfigurationPropertiesConfigurer
extends org.apache.
case "timeoutDuration":
target.setTimeoutDuration(property(camelContext, java.lang.Long.class, value));
return true;
case "timeoutenabled":
case "timeoutEnabled": target.setTimeoutEnabled(property(camelContext,
java.lang.Boolean.class, value)); return true;
- case "timeoutpoolsize":
- case "timeoutPoolSize":
target.setTimeoutPoolSize(property(camelContext, java.lang.Integer.class,
value)); return true;
case "typedguard":
case "typedGuard": target.setTypedGuard(property(camelContext,
java.lang.String.class, value)); return true;
default: return false;
@@ -95,8 +92,6 @@ public class FaultToleranceConfigurationPropertiesConfigurer
extends org.apache.
case "timeoutDuration": return java.lang.Long.class;
case "timeoutenabled":
case "timeoutEnabled": return java.lang.Boolean.class;
- case "timeoutpoolsize":
- case "timeoutPoolSize": return java.lang.Integer.class;
case "typedguard":
case "typedGuard": return java.lang.String.class;
default: return null;
@@ -126,8 +121,6 @@ public class
FaultToleranceConfigurationPropertiesConfigurer 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-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index ff6f31dbb39e..0b648bd4ea81 100644
---
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -267,14 +267,13 @@
{ "name": "camel.faulttolerance.bulkheadEnabled", "required": false,
"description": "Whether bulkhead is enabled or not on the circuit breaker.
Default is false.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"boolean", "javaType": "java.lang.Boolean", "defaultValue": false, "secret":
false },
{ "name": "camel.faulttolerance.bulkheadMaxConcurrentCalls", "required":
false, "description": "Configures the max amount of concurrent calls the
bulkhead will support. Default value is 10.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false
},
{ "name": "camel.faulttolerance.bulkheadWaitingTaskQueue", "required":
false, "description": "Configures the task queue size for holding waiting tasks
to be processed by the bulkhead. Default value is 10.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false
},
- { "name": "camel.faulttolerance.delay", "required": false, "description":
"Control how long the circuit breaker stays open. The value are in seconds and
the default is 5 seconds.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Long", "defaultValue": 5, "secret": false },
+ { "name": "camel.faulttolerance.delay", "required": false, "description":
"Control how long the circuit breaker stays open. The default is 5 seconds.",
"sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties",
"type": "integer", "javaType": "java.lang.Long", "defaultValue": 5000,
"secret": false },
{ "name": "camel.faulttolerance.failureRatio", "required": false,
"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. The threshold must be
greater than 0 and not greater than 100. Default value is 50 percentage.",
"sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties",
"type": "integer", "javaType": "java.lang.Inte [...]
{ "name": "camel.faulttolerance.requestVolumeThreshold", "required":
false, "description": "Controls the size of the rolling window used when the
circuit breaker is closed Default value is 20.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 20, "secret": false
},
{ "name": "camel.faulttolerance.successThreshold", "required": false,
"description": "Controls the number of trial calls which are allowed when the
circuit breaker is half-open Default value is 1.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 1, "secret": false
},
{ "name": "camel.faulttolerance.threadOffloadExecutorService", "required":
false, "description": "References a custom thread pool to use when offloading a
guarded action to another thread.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.faulttolerance.timeoutDuration", "required": false,
"description": "Configures the thread execution timeout. Default value is 1000
milliseconds.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Long", "defaultValue": 1000, "secret": false
},
{ "name": "camel.faulttolerance.timeoutEnabled", "required": false,
"description": "Whether timeout is enabled or not on the circuit breaker.
Default is false.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"boolean", "javaType": "java.lang.Boolean", "defaultValue": false, "secret":
false },
- { "name": "camel.faulttolerance.timeoutPoolSize", "required": false,
"description": "Configures the pool size of the thread pool when timeout is
enabled. Default value is 10.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false
},
{ "name": "camel.faulttolerance.typedGuard", "required": false,
"description": "Refers to an existing io.smallrye.faulttolerance.api.TypedGuard
instance to lookup and use from the registry. When using this, then any other
TypedGuard circuit breaker options are not in use.", "sourceType":
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type":
"string", "javaType": "java.lang.String", "secret": false },
{ "name": "camel.health.consumersEnabled", "required": false,
"description": "Whether consumers health check is enabled", "sourceType":
"org.apache.camel.main.HealthConfigurationProperties", "type": "boolean",
"javaType": "java.lang.Boolean", "defaultValue": true, "secret": false },
{ "name": "camel.health.enabled", "required": false, "description":
"Whether health check is enabled globally", "sourceType":
"org.apache.camel.main.HealthConfigurationProperties", "type": "boolean",
"javaType": "java.lang.Boolean", "defaultValue": true, "secret": false },
diff --git a/core/camel-main/src/main/docs/main.adoc
b/core/camel-main/src/main/docs/main.adoc
index cfd34759d89d..7a4ab4b3e9fc 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -657,7 +657,7 @@ The camel.metrics supports 16 options, which are listed
below.
=== Fault Tolerance EIP Circuit Breaker configurations
-The camel.faulttolerance supports 12 options, which are listed below.
+The camel.faulttolerance supports 11 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
@@ -665,14 +665,13 @@ The camel.faulttolerance supports 12 options, which are
listed below.
| *camel.faulttolerance.bulkheadEnabled* | Whether bulkhead is enabled or not
on the circuit breaker. Default is false. | false | Boolean
| *camel.faulttolerance.bulkheadMaxConcurrentCalls* | Configures the max
amount of concurrent calls the bulkhead will support. Default value is 10. | 10
| Integer
| *camel.faulttolerance.bulkheadWaitingTaskQueue* | Configures the task queue
size for holding waiting tasks to be processed by the bulkhead. Default value
is 10. | 10 | Integer
-| *camel.faulttolerance.delay* | Control how long the circuit breaker stays
open. The value are in seconds and the default is 5 seconds. | 5 | Long
+| *camel.faulttolerance.delay* | Control how long the circuit breaker stays
open. The default is 5 seconds. | 5000 | Long
| *camel.faulttolerance.failureRatio* | 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. The
threshold must be greater than 0 and not greater than 100. Default value is 50
percentage. | 50 | Integer
| *camel.faulttolerance.requestVolumeThreshold* | Controls the size of the
rolling window used when the circuit breaker is closed Default value is 20. |
20 | Integer
| *camel.faulttolerance.successThreshold* | Controls the number of trial calls
which are allowed when the circuit breaker is half-open Default value is 1. | 1
| Integer
| *camel.faulttolerance.threadOffloadExecutorService* | References a custom
thread pool to use when offloading a guarded action to another thread. | |
String
| *camel.faulttolerance.timeoutDuration* | Configures the thread execution
timeout. Default value is 1000 milliseconds. | 1000 | Long
| *camel.faulttolerance.timeoutEnabled* | Whether timeout is enabled or not on
the circuit breaker. Default is false. | false | Boolean
-| *camel.faulttolerance.timeoutPoolSize* | Configures the pool size of the
thread pool when timeout is enabled. Default value is 10. | 10 | Integer
| *camel.faulttolerance.typedGuard* | Refers to an existing
io.smallrye.faulttolerance.api.TypedGuard instance to lookup and use from the
registry. When using this, then any other TypedGuard circuit breaker options
are not in use. | | String
|===
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..59c0c3a249d7 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
@@ -29,7 +29,7 @@ public class FaultToleranceConfigurationProperties implements
BootstrapCloseable
private MainConfigurationProperties parent;
private String typedGuard;
- @Metadata(defaultValue = "5")
+ @Metadata(defaultValue = "5000")
private Long delay;
@Metadata(defaultValue = "1")
private Integer successThreshold;
@@ -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")
@@ -84,7 +82,7 @@ public class FaultToleranceConfigurationProperties implements
BootstrapCloseable
}
/**
- * Control how long the circuit breaker stays open. The value are in
seconds and the default is 5 seconds.
+ * Control how long the circuit breaker stays open. The default is 5
seconds.
*/
public void setDelay(Long delay) {
this.delay = delay;
@@ -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;
}
@@ -213,7 +200,7 @@ public class FaultToleranceConfigurationProperties
implements BootstrapCloseable
}
/**
- * Control how long the circuit breaker stays open. The value are in
seconds and the default is 5 seconds.
+ * Control how long the circuit breaker stays open. The default is 5
seconds.
*/
public FaultToleranceConfigurationProperties withDelay(Long delay) {
this.delay = delay;
@@ -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/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 9fa15ea4af32..e8213adb2cac 100644
---
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -418,7 +418,6 @@ public class ModelParser extends BaseParser {
case "threadOffloadExecutorService":
def.setThreadOffloadExecutorService(val); yield true;
case "timeoutDuration": def.setTimeoutDuration(val); yield true;
case "timeoutEnabled": def.setTimeoutEnabled(val); yield true;
- case "timeoutPoolSize": def.setTimeoutPoolSize(val); yield true;
case "typedGuard": def.setTypedGuard(val); yield true;
default: yield identifiedTypeAttributeHandler().accept(def, key,
val);
};
diff --git
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 8a11609ec37b..00128f8a4b65 100644
---
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -1014,7 +1014,6 @@ public class ModelWriter extends BaseWriter {
doWriteAttribute("failureRatio", def.getFailureRatio(), "50");
doWriteAttribute("timeoutEnabled", def.getTimeoutEnabled(), "false");
doWriteAttribute("timeoutDuration", def.getTimeoutDuration(), "1000");
- doWriteAttribute("timeoutPoolSize", def.getTimeoutPoolSize(), "10");
doWriteAttribute("bulkheadEnabled", def.getBulkheadEnabled(), "false");
doWriteAttribute("bulkheadMaxConcurrentCalls",
def.getBulkheadMaxConcurrentCalls(), "10");
doWriteAttribute("bulkheadWaitingTaskQueue",
def.getBulkheadWaitingTaskQueue(), "10");
diff --git
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
index 0ee31fbdc64b..16c4a74440de 100644
---
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
+++
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
@@ -1009,7 +1009,6 @@ public class YamlModelWriter extends
YamlModelWriterSupport {
doWriteAttribute(jo, "failureRatio", def.getFailureRatio(), "50");
doWriteAttribute(jo, "timeoutEnabled", def.getTimeoutEnabled(),
"false");
doWriteAttribute(jo, "timeoutDuration", def.getTimeoutDuration(),
"1000");
- doWriteAttribute(jo, "timeoutPoolSize", def.getTimeoutPoolSize(),
"10");
doWriteAttribute(jo, "bulkheadEnabled", def.getBulkheadEnabled(),
"false");
doWriteAttribute(jo, "bulkheadMaxConcurrentCalls",
def.getBulkheadMaxConcurrentCalls(), "10");
doWriteAttribute(jo, "bulkheadWaitingTaskQueue",
def.getBulkheadWaitingTaskQueue(), "10");
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 82aacf6f0e42..6a63aff5955f 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
@@ -1086,6 +1086,24 @@ with the option itself, which was changed from seconds
to milliseconds in the sa
If you have JMX-based monitoring that reads this attribute, update the
expected unit from seconds
to milliseconds.
+=== 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
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index 41fcaa4e3973..01e0cd561c18 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -5300,7 +5300,6 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
@YamlProperty(name = "threadOffloadExecutorService", type
= "string", description = "References a custom thread pool to use when
offloading a guarded action to another thread.", displayName = "Thread Offload
Executor Service"),
@YamlProperty(name = "timeoutDuration", type = "string",
defaultValue = "1000", description = "Configures the thread execution timeout.
Default value is 1 second.", displayName = "Timeout Duration"),
@YamlProperty(name = "timeoutEnabled", type = "boolean",
defaultValue = "false", description = "Whether timeout is enabled or not on the
circuit breaker.", displayName = "Timeout Enabled"),
- @YamlProperty(name = "timeoutPoolSize", type = "number",
deprecated = true, defaultValue = "10", description = "Deprecated: no longer in
use since the switch to TypedGuard API (CAMEL-21857).", displayName = "Timeout
Pool Size"),
@YamlProperty(name = "typedGuard", type = "string",
description = "Refers to an existing io.smallrye.faulttolerance.api.TypedGuard
instance to lookup and use from the registry. When using this, then any other
TypedGuard circuit breaker options are not in use.", displayName = "Typed
Guard")
}
)
@@ -5374,11 +5373,6 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
target.setTimeoutEnabled(val);
break;
}
- case "timeoutPoolSize": {
- String val = asText(node);
- target.setTimeoutPoolSize(val);
- break;
- }
case "typedGuard": {
String val = asText(node);
target.setTypedGuard(val);
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
index 677578932c88..f80e09111ed4 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
@@ -1472,13 +1472,6 @@
"description" : "Whether timeout is enabled or not on the circuit
breaker.",
"default" : false
},
- "timeoutPoolSize" : {
- "type" : "number",
- "title" : "Timeout Pool Size",
- "description" : "Deprecated: no longer in use since the switch to
TypedGuard API (CAMEL-21857).",
- "deprecated" : true,
- "default" : 10
- },
"typedGuard" : {
"type" : "string",
"title" : "Typed Guard",
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index cdc6fc079d0f..03bf74cf5316 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -2107,13 +2107,6 @@
"description" : "Whether timeout is enabled or not on the circuit
breaker.",
"default" : false
},
- "timeoutPoolSize" : {
- "type" : "number",
- "title" : "Timeout Pool Size",
- "description" : "Deprecated: no longer in use since the switch to
TypedGuard API (CAMEL-21857).",
- "deprecated" : true,
- "default" : 10
- },
"typedGuard" : {
"type" : "string",
"title" : "Typed Guard",