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 4ae2c4b793b Expose `recordException` and `ignoreException` on
Resilience4j configuration (#13557)
4ae2c4b793b is described below
commit 4ae2c4b793b5fcf45624dcbcf2d9a48f00c9c764
Author: Adriano Machado <[email protected]>
AuthorDate: Thu Mar 21 07:21:24 2024 -0400
Expose `recordException` and `ignoreException` on Resilience4j
configuration (#13557)
---
.../catalog/models/resilience4jConfiguration.json | 4 ++-
.../apache/camel/catalog/schemas/camel-spring.xsd | 24 ++++++++++++++-
.../component/resilience4j/ResilienceReifier.java | 28 +++++++++++++++++-
...ilience4jConfigurationDefinitionConfigurer.java | 25 ++++++++++++++++
.../camel/model/resilience4jConfiguration.json | 4 ++-
.../model/Resilience4jConfigurationCommon.java | 34 ++++++++++++++++++++++
.../java/org/apache/camel/xml/in/ModelParser.java | 14 +++++++--
.../java/org/apache/camel/xml/out/ModelWriter.java | 8 +++++
.../org/apache/camel/yaml/out/ModelWriter.java | 8 +++++
.../dsl/yaml/deserializers/ModelDeserializers.java | 12 ++++++++
.../generated/resources/schema/camelYamlDsl.json | 16 ++++++++++
11 files changed, 171 insertions(+), 6 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/resilience4jConfiguration.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/resilience4jConfiguration.json
index 70716ee8a19..404f3f6647a 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/resilience4jConfiguration.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/resilience4jConfiguration.json
@@ -32,6 +32,8 @@
"timeoutEnabled": { "index": 17, "kind": "attribute", "displayName":
"Timeout Enabled", "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. Default is false." },
"timeoutExecutorService": { "index": 18, "kind": "attribute",
"displayName": "Timeout Executor Service", "label": "advanced", "required":
false, "type": "object", "javaType": "java.util.concurrent.ExecutorService",
"deprecated": false, "autowired": false, "secret": false, "description":
"References to a custom thread pool to use when timeout is enabled (uses
ForkJoinPool#commonPool() by default)" },
"timeoutDuration": { "index": 19, "kind": "attribute", "displayName":
"Timeout Duration", "required": false, "type": "integer", "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "1000", "description": "Configures the thread execution
timeout. Default value is 1 second." },
- "timeoutCancelRunningFuture": { "index": 20, "kind": "attribute",
"displayName": "Timeout Cancel Running Future", "label": "advanced",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Configures whether cancel is called on the running future.
Defaults to true." }
+ "timeoutCancelRunningFuture": { "index": 20, "kind": "attribute",
"displayName": "Timeout Cancel Running Future", "label": "advanced",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Configures whether cancel is called on the running future.
Defaults to true." },
+ "recordException": { "index": 21, "kind": "element", "displayName":
"Record Exception", "label": "advanced", "required": false, "type": "array",
"javaType": "java.util.List<java.lang.String>", "deprecated": false,
"autowired": false, "secret": false, "description": "Configure a list of
exceptions that are recorded as a failure and thus increase the failure rate.
Any exception matching or inheriting from one of the list counts as a failure,
unless explicitly ignored via ignoreExceptions." },
+ "ignoreException": { "index": 22, "kind": "element", "displayName":
"Ignore Exception", "label": "advanced", "required": false, "type": "array",
"javaType": "java.util.List<java.lang.String>", "deprecated": false,
"autowired": false, "secret": false, "description": "Configure a list of
exceptions that are ignored and neither count as a failure nor success. Any
exception matching or inheriting from one of the list will not count as a
failure nor success, even if the exceptions is part [...]
}
}
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 41b81e905d2..de2db82edea 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
@@ -4473,7 +4473,29 @@ configuring the circuit breaker EIP.
<xs:complexType name="resilience4JConfigurationCommon">
<xs:complexContent>
<xs:extension base="tns:identifiedType">
- <xs:sequence/>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
name="recordException" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+<![CDATA[
+Configure a list of exceptions that are recorded as a failure and thus
increase the failure rate. Any exception matching
+or inheriting from one of the list counts as a failure, unless explicitly
ignored via ignoreExceptions.
+]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
name="ignoreException" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+<![CDATA[
+Configure a list of exceptions that are ignored and neither count as a failure
nor success. Any exception matching or
+inheriting from one of the list will not count as a failure nor success, even
if the exceptions is part of
+recordExceptions.
+]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
<xs:attribute name="circuitBreaker" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
diff --git
a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java
b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java
index 2b63ca87eda..bf542762731 100644
---
a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java
+++
b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java
@@ -17,7 +17,9 @@
package org.apache.camel.component.resilience4j;
import java.time.Duration;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
@@ -81,7 +83,7 @@ public class ResilienceReifier extends
ProcessorReifier<CircuitBreakerDefinition
return answer;
}
- private CircuitBreakerConfig
configureCircuitBreaker(Resilience4jConfigurationCommon config) {
+ private CircuitBreakerConfig
configureCircuitBreaker(Resilience4jConfigurationCommon config) throws
ClassNotFoundException {
CircuitBreakerConfig.Builder builder = CircuitBreakerConfig.custom();
if (config.getAutomaticTransitionFromOpenToHalfOpenEnabled() != null) {
builder.automaticTransitionFromOpenToHalfOpenEnabled(
@@ -114,6 +116,12 @@ public class ResilienceReifier extends
ProcessorReifier<CircuitBreakerDefinition
if (config.getWritableStackTraceEnabled() != null) {
builder.writableStackTraceEnabled(parseBoolean(config.getWritableStackTraceEnabled()));
}
+ if (config.getRecordExceptions() != null) {
+ builder.ignoreExceptions(createRecordExceptionClasses());
+ }
+ if (config.getIgnoreExceptions() != null) {
+ builder.ignoreExceptions(createIgnoreExceptionClasses());
+ }
return builder.build();
}
@@ -234,4 +242,22 @@ public class ResilienceReifier extends
ProcessorReifier<CircuitBreakerDefinition
});
}
+ private Class<? extends Throwable>[] createRecordExceptionClasses() throws
ClassNotFoundException {
+ return
resolveExceptions(definition.resilience4jConfiguration().getRecordExceptions());
+ }
+
+ private Class<? extends Throwable>[] createIgnoreExceptionClasses() throws
ClassNotFoundException {
+ return
resolveExceptions(definition.resilience4jConfiguration().getIgnoreExceptions());
+ }
+
+ private Class<? extends Throwable>[] resolveExceptions(List<String> list)
throws ClassNotFoundException {
+ // must use the class resolver from CamelContext to load classes to
ensure it can
+ // be loaded in all kind of environments such as JEE servers and OSGi
etc.
+ List<Class<? extends Throwable>> answer = new ArrayList<>(list.size());
+ for (String name : list) {
+ Class<Throwable> type =
camelContext.getClassResolver().resolveMandatoryClass(name, Throwable.class);
+ answer.add(type);
+ }
+ return answer.toArray(new Class[0]);
+ }
}
diff --git
a/core/camel-core-model/src/generated/java/org/apache/camel/model/Resilience4jConfigurationDefinitionConfigurer.java
b/core/camel-core-model/src/generated/java/org/apache/camel/model/Resilience4jConfigurationDefinitionConfigurer.java
index 07c7190c079..b8bb275c5a7 100644
---
a/core/camel-core-model/src/generated/java/org/apache/camel/model/Resilience4jConfigurationDefinitionConfigurer.java
+++
b/core/camel-core-model/src/generated/java/org/apache/camel/model/Resilience4jConfigurationDefinitionConfigurer.java
@@ -28,8 +28,10 @@ public class Resilience4jConfigurationDefinitionConfigurer
extends org.apache.ca
map.put("Config", java.lang.String.class);
map.put("FailureRateThreshold", java.lang.String.class);
map.put("Id", java.lang.String.class);
+ map.put("IgnoreExceptions", java.util.List.class);
map.put("MinimumNumberOfCalls", java.lang.String.class);
map.put("PermittedNumberOfCallsInHalfOpenState",
java.lang.String.class);
+ map.put("RecordExceptions", java.util.List.class);
map.put("SlidingWindowSize", java.lang.String.class);
map.put("SlidingWindowType", java.lang.String.class);
map.put("SlowCallDurationThreshold", java.lang.String.class);
@@ -62,10 +64,14 @@ public class Resilience4jConfigurationDefinitionConfigurer
extends org.apache.ca
case "failureratethreshold":
case "failureRateThreshold":
target.setFailureRateThreshold(property(camelContext, java.lang.String.class,
value)); return true;
case "id": target.setId(property(camelContext, java.lang.String.class,
value)); return true;
+ case "ignoreexceptions":
+ case "ignoreExceptions":
target.setIgnoreExceptions(property(camelContext, java.util.List.class,
value)); return true;
case "minimumnumberofcalls":
case "minimumNumberOfCalls":
target.setMinimumNumberOfCalls(property(camelContext, java.lang.String.class,
value)); return true;
case "permittednumberofcallsinhalfopenstate":
case "permittedNumberOfCallsInHalfOpenState":
target.setPermittedNumberOfCallsInHalfOpenState(property(camelContext,
java.lang.String.class, value)); return true;
+ case "recordexceptions":
+ case "recordExceptions":
target.setRecordExceptions(property(camelContext, java.util.List.class,
value)); return true;
case "slidingwindowsize":
case "slidingWindowSize":
target.setSlidingWindowSize(property(camelContext, java.lang.String.class,
value)); return true;
case "slidingwindowtype":
@@ -114,10 +120,14 @@ public class
Resilience4jConfigurationDefinitionConfigurer extends org.apache.ca
case "failureratethreshold":
case "failureRateThreshold": return java.lang.String.class;
case "id": return java.lang.String.class;
+ case "ignoreexceptions":
+ case "ignoreExceptions": return java.util.List.class;
case "minimumnumberofcalls":
case "minimumNumberOfCalls": return java.lang.String.class;
case "permittednumberofcallsinhalfopenstate":
case "permittedNumberOfCallsInHalfOpenState": return
java.lang.String.class;
+ case "recordexceptions":
+ case "recordExceptions": return java.util.List.class;
case "slidingwindowsize":
case "slidingWindowSize": return java.lang.String.class;
case "slidingwindowtype":
@@ -162,10 +172,14 @@ public class
Resilience4jConfigurationDefinitionConfigurer extends org.apache.ca
case "failureratethreshold":
case "failureRateThreshold": return target.getFailureRateThreshold();
case "id": return target.getId();
+ case "ignoreexceptions":
+ case "ignoreExceptions": return target.getIgnoreExceptions();
case "minimumnumberofcalls":
case "minimumNumberOfCalls": return target.getMinimumNumberOfCalls();
case "permittednumberofcallsinhalfopenstate":
case "permittedNumberOfCallsInHalfOpenState": return
target.getPermittedNumberOfCallsInHalfOpenState();
+ case "recordexceptions":
+ case "recordExceptions": return target.getRecordExceptions();
case "slidingwindowsize":
case "slidingWindowSize": return target.getSlidingWindowSize();
case "slidingwindowtype":
@@ -191,5 +205,16 @@ public class Resilience4jConfigurationDefinitionConfigurer
extends org.apache.ca
default: return null;
}
}
+
+ @Override
+ public Object getCollectionValueType(Object target, String name, boolean
ignoreCase) {
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "ignoreexceptions":
+ case "ignoreExceptions": return java.lang.String.class;
+ case "recordexceptions":
+ case "recordExceptions": return java.lang.String.class;
+ default: return null;
+ }
+ }
}
diff --git
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/resilience4jConfiguration.json
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/resilience4jConfiguration.json
index 70716ee8a19..404f3f6647a 100644
---
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/resilience4jConfiguration.json
+++
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/resilience4jConfiguration.json
@@ -32,6 +32,8 @@
"timeoutEnabled": { "index": 17, "kind": "attribute", "displayName":
"Timeout Enabled", "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. Default is false." },
"timeoutExecutorService": { "index": 18, "kind": "attribute",
"displayName": "Timeout Executor Service", "label": "advanced", "required":
false, "type": "object", "javaType": "java.util.concurrent.ExecutorService",
"deprecated": false, "autowired": false, "secret": false, "description":
"References to a custom thread pool to use when timeout is enabled (uses
ForkJoinPool#commonPool() by default)" },
"timeoutDuration": { "index": 19, "kind": "attribute", "displayName":
"Timeout Duration", "required": false, "type": "integer", "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "1000", "description": "Configures the thread execution
timeout. Default value is 1 second." },
- "timeoutCancelRunningFuture": { "index": 20, "kind": "attribute",
"displayName": "Timeout Cancel Running Future", "label": "advanced",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Configures whether cancel is called on the running future.
Defaults to true." }
+ "timeoutCancelRunningFuture": { "index": 20, "kind": "attribute",
"displayName": "Timeout Cancel Running Future", "label": "advanced",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Configures whether cancel is called on the running future.
Defaults to true." },
+ "recordException": { "index": 21, "kind": "element", "displayName":
"Record Exception", "label": "advanced", "required": false, "type": "array",
"javaType": "java.util.List<java.lang.String>", "deprecated": false,
"autowired": false, "secret": false, "description": "Configure a list of
exceptions that are recorded as a failure and thus increase the failure rate.
Any exception matching or inheriting from one of the list counts as a failure,
unless explicitly ignored via ignoreExceptions." },
+ "ignoreException": { "index": 22, "kind": "element", "displayName":
"Ignore Exception", "label": "advanced", "required": false, "type": "array",
"javaType": "java.util.List<java.lang.String>", "deprecated": false,
"autowired": false, "secret": false, "description": "Configure a list of
exceptions that are ignored and neither count as a failure nor success. Any
exception matching or inheriting from one of the list will not count as a
failure nor success, even if the exceptions is part [...]
}
}
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/Resilience4jConfigurationCommon.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/Resilience4jConfigurationCommon.java
index d61fade94f3..0578a40c5a8 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/Resilience4jConfigurationCommon.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/Resilience4jConfigurationCommon.java
@@ -16,11 +16,14 @@
*/
package org.apache.camel.model;
+import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.ForkJoinPool;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
+import jakarta.xml.bind.annotation.XmlElement;
import org.apache.camel.spi.Metadata;
@@ -87,6 +90,12 @@ public class Resilience4jConfigurationCommon extends
IdentifiedType {
@XmlAttribute
@Metadata(label = "advanced", defaultValue = "true", javaType =
"java.lang.Boolean")
private String timeoutCancelRunningFuture;
+ @XmlElement(name = "recordException")
+ @Metadata(label = "advanced")
+ private List<String> recordExceptions = new ArrayList<>();
+ @XmlElement(name = "ignoreException")
+ @Metadata(label = "advanced")
+ private List<String> ignoreExceptions = new ArrayList<>();
// Getter/Setter
//
-------------------------------------------------------------------------
@@ -358,4 +367,29 @@ public class Resilience4jConfigurationCommon extends
IdentifiedType {
public void setTimeoutCancelRunningFuture(String
timeoutCancelRunningFuture) {
this.timeoutCancelRunningFuture = timeoutCancelRunningFuture;
}
+
+ public List<String> getRecordExceptions() {
+ return recordExceptions;
+ }
+
+ /**
+ * Configure a list of exceptions that are recorded as a failure and thus
increase the failure rate. Any exception
+ * matching or inheriting from one of the list counts as a failure, unless
explicitly ignored via ignoreExceptions.
+ */
+ public void setRecordExceptions(List<String> recordExceptions) {
+ this.recordExceptions = recordExceptions;
+ }
+
+ public List<String> getIgnoreExceptions() {
+ return ignoreExceptions;
+ }
+
+ /**
+ * Configure a list of exceptions that are ignored and neither count as a
failure nor success. Any exception
+ * matching or inheriting from one of the list will not count as a failure
nor success, even if the exceptions is
+ * part of recordExceptions.
+ */
+ public void setIgnoreExceptions(List<String> ignoreExceptions) {
+ this.ignoreExceptions = ignoreExceptions;
+ }
}
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 a1823324f52..0befa365a29 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
@@ -250,7 +250,7 @@ public class ModelParser extends BaseParser {
}
protected Resilience4jConfigurationDefinition
doParseResilience4jConfigurationDefinition() throws IOException,
XmlPullParserException {
return doParse(new Resilience4jConfigurationDefinition(),
- resilience4jConfigurationCommonAttributeHandler(),
noElementHandler(), noValueHandler());
+ resilience4jConfigurationCommonAttributeHandler(),
resilience4jConfigurationCommonElementHandler(), noValueHandler());
}
protected FaultToleranceConfigurationDefinition
doParseFaultToleranceConfigurationDefinition() throws IOException,
XmlPullParserException {
return doParse(new FaultToleranceConfigurationDefinition(),
@@ -937,8 +937,18 @@ public class ModelParser extends BaseParser {
return true;
};
}
+ protected <T extends Resilience4jConfigurationCommon> ElementHandler<T>
resilience4jConfigurationCommonElementHandler() {
+ return (def, key) -> {
+ switch (key) {
+ case "ignoreException": doAdd(doParseText(),
def.getIgnoreExceptions(), def::setIgnoreExceptions); break;
+ case "recordException": doAdd(doParseText(),
def.getRecordExceptions(), def::setRecordExceptions); break;
+ default: return false;
+ }
+ return true;
+ };
+ }
protected Resilience4jConfigurationCommon
doParseResilience4jConfigurationCommon() throws IOException,
XmlPullParserException {
- return doParse(new Resilience4jConfigurationCommon(),
resilience4jConfigurationCommonAttributeHandler(), noElementHandler(),
noValueHandler());
+ return doParse(new Resilience4jConfigurationCommon(),
resilience4jConfigurationCommonAttributeHandler(),
resilience4jConfigurationCommonElementHandler(), noValueHandler());
}
protected RestContextRefDefinition doParseRestContextRefDefinition()
throws IOException, XmlPullParserException {
return doParse(new RestContextRefDefinition(), (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 4101ef5bc7b..f4ea46fe3c5 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
@@ -1984,12 +1984,19 @@ public class ModelWriter extends BaseWriter {
doWriteAttribute("bulkheadEnabled", def.getBulkheadEnabled());
doWriteAttribute("waitDurationInOpenState",
def.getWaitDurationInOpenState());
}
+ protected void doWriteResilience4jConfigurationCommonElements(
+ Resilience4jConfigurationCommon def)
+ throws IOException {
+ doWriteList(null, "ignoreException", def.getIgnoreExceptions(),
this::doWriteString);
+ doWriteList(null, "recordException", def.getRecordExceptions(),
this::doWriteString);
+ }
protected void doWriteResilience4jConfigurationCommon(
String name,
Resilience4jConfigurationCommon def)
throws IOException {
startElement(name);
doWriteResilience4jConfigurationCommonAttributes(def);
+ doWriteResilience4jConfigurationCommonElements(def);
endElement(name);
}
protected void doWriteResilience4jConfigurationDefinition(
@@ -1998,6 +2005,7 @@ public class ModelWriter extends BaseWriter {
throws IOException {
startElement(name);
doWriteResilience4jConfigurationCommonAttributes(def);
+ doWriteResilience4jConfigurationCommonElements(def);
endElement(name);
}
protected void doWriteRestContextRefDefinition(
diff --git
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
index 16468140df5..1de6d98bbfd 100644
---
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
+++
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
@@ -1984,12 +1984,19 @@ public class ModelWriter extends BaseWriter {
doWriteAttribute("bulkheadEnabled", def.getBulkheadEnabled());
doWriteAttribute("waitDurationInOpenState",
def.getWaitDurationInOpenState());
}
+ protected void doWriteResilience4jConfigurationCommonElements(
+ Resilience4jConfigurationCommon def)
+ throws IOException {
+ doWriteList(null, "ignoreException", def.getIgnoreExceptions(),
this::doWriteString);
+ doWriteList(null, "recordException", def.getRecordExceptions(),
this::doWriteString);
+ }
protected void doWriteResilience4jConfigurationCommon(
String name,
Resilience4jConfigurationCommon def)
throws IOException {
startElement(name);
doWriteResilience4jConfigurationCommonAttributes(def);
+ doWriteResilience4jConfigurationCommonElements(def);
endElement(name);
}
protected void doWriteResilience4jConfigurationDefinition(
@@ -1998,6 +2005,7 @@ public class ModelWriter extends BaseWriter {
throws IOException {
startElement(name);
doWriteResilience4jConfigurationCommonAttributes(def);
+ doWriteResilience4jConfigurationCommonElements(def);
endElement(name);
}
protected void doWriteRestContextRefDefinition(
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 38f531bee8a..6e27b84e32f 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
@@ -13371,8 +13371,10 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
@YamlProperty(name = "config", type = "string",
description = "Refers to an existing
io.github.resilience4j.circuitbreaker.CircuitBreakerConfig instance to lookup
and use from the registry.", displayName = "Config"),
@YamlProperty(name = "failureRateThreshold", type =
"number", 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. The threshold must be greater than 0 and not greater than 100. Default
value is 50 percentage.", displayName = "Failure Rate Threshold"),
@YamlProperty(name = "id", type = "string", description =
"The id of this node", displayName = "Id"),
+ @YamlProperty(name = "ignoreException", type =
"array:string", description = "Configure a list of exceptions that are ignored
and neither count as a failure nor success. Any exception matching or
inheriting from one of the list will not count as a failure nor success, even
if the exceptions is part of recordExceptions.", displayName = "Ignore
Exception"),
@YamlProperty(name = "minimumNumberOfCalls", type =
"number", defaultValue = "100", description = "Configures the minimum number of
calls which are required (per sliding window period) before the CircuitBreaker
can calculate the error rate. For example, if minimumNumberOfCalls is 10, then
at least 10 calls must be recorded, before the failure rate can be calculated.
If only 9 calls have been recorded the CircuitBreaker will not transition to
open even if all 9 calls h [...]
@YamlProperty(name =
"permittedNumberOfCallsInHalfOpenState", type = "number", defaultValue = "10",
description = "Configures the number of permitted calls when the CircuitBreaker
is half open. The size must be greater than 0. Default size is 10.",
displayName = "Permitted Number Of Calls In Half Open State"),
+ @YamlProperty(name = "recordException", type =
"array:string", description = "Configure a list of exceptions that are recorded
as a failure and thus increase the failure rate. Any exception matching or
inheriting from one of the list counts as a failure, unless explicitly ignored
via ignoreExceptions.", displayName = "Record Exception"),
@YamlProperty(name = "slidingWindowSize", type = "number",
defaultValue = "100", description = "Configures the size of the sliding window
which is used to record the outcome of calls when the CircuitBreaker is closed.
slidingWindowSize configures the size of the sliding window. Sliding window can
either be count-based or time-based. If slidingWindowType is COUNT_BASED, the
last slidingWindowSize calls are recorded and aggregated. If slidingWindowType
is TIME_BASED, th [...]
@YamlProperty(name = "slidingWindowType", type =
"enum:TIME_BASED,COUNT_BASED", defaultValue = "COUNT_BASED", description =
"Configures the type of the sliding window which is used to record the outcome
of calls when the CircuitBreaker is closed. Sliding window can either be
count-based or time-based. If slidingWindowType is COUNT_BASED, the last
slidingWindowSize calls are recorded and aggregated. If slidingWindowType is
TIME_BASED, the calls of the last slidingWindo [...]
@YamlProperty(name = "slowCallDurationThreshold", type =
"number", defaultValue = "60", description = "Configures the duration threshold
(seconds) above which calls are considered as slow and increase the slow calls
percentage. Default value is 60 seconds.", displayName = "Slow Call Duration
Threshold"),
@@ -13441,6 +13443,11 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
target.setId(val);
break;
}
+ case "ignoreException": {
+ java.util.List<String> val = asStringList(node);
+ target.setIgnoreExceptions(val);
+ break;
+ }
case "minimumNumberOfCalls": {
String val = asText(node);
target.setMinimumNumberOfCalls(val);
@@ -13451,6 +13458,11 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
target.setPermittedNumberOfCallsInHalfOpenState(val);
break;
}
+ case "recordException": {
+ java.util.List<String> val = asStringList(node);
+ target.setRecordExceptions(val);
+ break;
+ }
case "slidingWindowSize": {
String val = asText(node);
target.setSlidingWindowSize(val);
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 7f5cb528931..96c44926b48 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
@@ -4850,6 +4850,14 @@
"title" : "Id",
"description" : "The id of this node"
},
+ "ignoreException" : {
+ "type" : "array",
+ "title" : "Ignore Exception",
+ "description" : "Configure a list of exceptions that are ignored
and neither count as a failure nor success. Any exception matching or
inheriting from one of the list will not count as a failure nor success, even
if the exceptions is part of recordExceptions.",
+ "items" : {
+ "type" : "string"
+ }
+ },
"minimumNumberOfCalls" : {
"type" : "number",
"title" : "Minimum Number Of Calls",
@@ -4862,6 +4870,14 @@
"description" : "Configures the number of permitted calls when the
CircuitBreaker is half open. The size must be greater than 0. Default size is
10.",
"default" : "10"
},
+ "recordException" : {
+ "type" : "array",
+ "title" : "Record Exception",
+ "description" : "Configure a list of exceptions that are recorded
as a failure and thus increase the failure rate. Any exception matching or
inheriting from one of the list counts as a failure, unless explicitly ignored
via ignoreExceptions.",
+ "items" : {
+ "type" : "string"
+ }
+ },
"slidingWindowSize" : {
"type" : "number",
"title" : "Sliding Window Size",