This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch kamelet2 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 842e0cf15a1862e73236dc30332a93f2f0127e8a Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jan 27 07:16:10 2025 +0100 CAMEL-21599: camel-kamelet - Rework error handler for kamelets to be more standard Camel. WIP --- .../apache/camel/catalog/components/kamelet.json | 4 +- .../org/apache/camel/reifier/ProcessorReifier.java | 2 + .../dsl/KameletEndpointBuilderFactory.java | 78 +++++++++++++++------- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/kamelet.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/kamelet.json index 377a4908ac5..1d696ba4356 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/kamelet.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/kamelet.json @@ -32,7 +32,7 @@ "lazyStartProducer": { "index": 5, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] "timeout": { "index": 6, "kind": "property", "displayName": "Timeout", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 30000, "description": "The timeout value to use if block is enabled." }, "autowiredEnabled": { "index": 7, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] - "noErrorHandler": { "index": 8, "kind": "property", "displayName": "No Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Kamelets, by default, will not do fine-grained error handling, but works in no-error-handler mode. This can be turned off, to use old behaviour in earlier versions of Camel." }, + "noErrorHandler": { "index": 8, "kind": "property", "displayName": "No Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether kamelets should use error handling or not. By default, the Kamelet uses the same error handler as from the calling route. This means that if the calling route has error handling that performs r [...] "routeTemplateLoaderListener": { "index": 9, "kind": "property", "displayName": "Route Template Loader Listener", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.RouteTemplateLoaderListener", "deprecated": false, "autowired": true, "secret": false, "description": "To plugin a custom listener for when the Kamelet component is loading Kamelets from external resources." } }, "properties": { @@ -46,6 +46,6 @@ "lazyStartProducer": { "index": 7, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...] "timeout": { "index": 8, "kind": "parameter", "displayName": "Timeout", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 30000, "description": "The timeout value to use if block is enabled." }, "location": { "index": 9, "kind": "parameter", "displayName": "Location", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Location of the Kamelet to use which can be specified as a resource from file system, classpath etc. The location cannot use wildcards, and must refer to a file including extension, for example file:\/etc\/ [...] - "noErrorHandler": { "index": 10, "kind": "parameter", "displayName": "No Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Kamelets, by default, will not do fine-grained error handling, but works in no-error-handler mode. This can be turned off, to use old behaviour in earlier versions of Camel." } + "noErrorHandler": { "index": 10, "kind": "parameter", "displayName": "No Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether kamelets should use error handling or not. By default, the Kamelet uses the same error handler as from the calling route. This means that if the calling route has error handling that performs [...] } } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java index 854a34a7c61..292c3ba7309 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java @@ -829,6 +829,8 @@ public abstract class ProcessorReifier<T extends ProcessorDefinition<?>> extends * Creates the processor and wraps it in any necessary interceptors and error handlers */ protected Channel makeProcessor() throws Exception { + // TODO: capture processor id + Processor processor = null; // allow any custom logic before we create the processor diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java index 08024723566..c0782f87929 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java @@ -189,13 +189,18 @@ public interface KameletEndpointBuilderFactory { return this; } /** - * Kamelets, by default, will not do fine-grained error handling, but - * works in no-error-handler mode. This can be turned off, to use old - * behaviour in earlier versions of Camel. + * Whether kamelets should use error handling or not. By default, the + * Kamelet uses the same error handler as from the calling route. This + * means that if the calling route has error handling that performs + * retries, or routing to a dead letter channel, then the kamelet route + * will use this also. This can be turned off by setting this option to + * true. If off then the kamelet route is not using error handling, and + * any exception thrown will for source kamelets be logged by the + * consumer, and the sink/action kamelets will fail processing. * * The option is a: <code>boolean</code> type. * - * Default: true + * Default: false * Group: advanced * * @param noErrorHandler the value to set @@ -206,13 +211,18 @@ public interface KameletEndpointBuilderFactory { return this; } /** - * Kamelets, by default, will not do fine-grained error handling, but - * works in no-error-handler mode. This can be turned off, to use old - * behaviour in earlier versions of Camel. + * Whether kamelets should use error handling or not. By default, the + * Kamelet uses the same error handler as from the calling route. This + * means that if the calling route has error handling that performs + * retries, or routing to a dead letter channel, then the kamelet route + * will use this also. This can be turned off by setting this option to + * true. If off then the kamelet route is not using error handling, and + * any exception thrown will for source kamelets be logged by the + * consumer, and the sink/action kamelets will fail processing. * * The option will be converted to a <code>boolean</code> type. * - * Default: true + * Default: false * Group: advanced * * @param noErrorHandler the value to set @@ -404,13 +414,18 @@ public interface KameletEndpointBuilderFactory { return this; } /** - * Kamelets, by default, will not do fine-grained error handling, but - * works in no-error-handler mode. This can be turned off, to use old - * behaviour in earlier versions of Camel. + * Whether kamelets should use error handling or not. By default, the + * Kamelet uses the same error handler as from the calling route. This + * means that if the calling route has error handling that performs + * retries, or routing to a dead letter channel, then the kamelet route + * will use this also. This can be turned off by setting this option to + * true. If off then the kamelet route is not using error handling, and + * any exception thrown will for source kamelets be logged by the + * consumer, and the sink/action kamelets will fail processing. * * The option is a: <code>boolean</code> type. * - * Default: true + * Default: false * Group: advanced * * @param noErrorHandler the value to set @@ -421,13 +436,18 @@ public interface KameletEndpointBuilderFactory { return this; } /** - * Kamelets, by default, will not do fine-grained error handling, but - * works in no-error-handler mode. This can be turned off, to use old - * behaviour in earlier versions of Camel. + * Whether kamelets should use error handling or not. By default, the + * Kamelet uses the same error handler as from the calling route. This + * means that if the calling route has error handling that performs + * retries, or routing to a dead letter channel, then the kamelet route + * will use this also. This can be turned off by setting this option to + * true. If off then the kamelet route is not using error handling, and + * any exception thrown will for source kamelets be logged by the + * consumer, and the sink/action kamelets will fail processing. * * The option will be converted to a <code>boolean</code> type. * - * Default: true + * Default: false * Group: advanced * * @param noErrorHandler the value to set @@ -481,13 +501,18 @@ public interface KameletEndpointBuilderFactory { return this; } /** - * Kamelets, by default, will not do fine-grained error handling, but - * works in no-error-handler mode. This can be turned off, to use old - * behaviour in earlier versions of Camel. + * Whether kamelets should use error handling or not. By default, the + * Kamelet uses the same error handler as from the calling route. This + * means that if the calling route has error handling that performs + * retries, or routing to a dead letter channel, then the kamelet route + * will use this also. This can be turned off by setting this option to + * true. If off then the kamelet route is not using error handling, and + * any exception thrown will for source kamelets be logged by the + * consumer, and the sink/action kamelets will fail processing. * * The option is a: <code>boolean</code> type. * - * Default: true + * Default: false * Group: advanced * * @param noErrorHandler the value to set @@ -498,13 +523,18 @@ public interface KameletEndpointBuilderFactory { return this; } /** - * Kamelets, by default, will not do fine-grained error handling, but - * works in no-error-handler mode. This can be turned off, to use old - * behaviour in earlier versions of Camel. + * Whether kamelets should use error handling or not. By default, the + * Kamelet uses the same error handler as from the calling route. This + * means that if the calling route has error handling that performs + * retries, or routing to a dead letter channel, then the kamelet route + * will use this also. This can be turned off by setting this option to + * true. If off then the kamelet route is not using error handling, and + * any exception thrown will for source kamelets be logged by the + * consumer, and the sink/action kamelets will fail processing. * * The option will be converted to a <code>boolean</code> type. * - * Default: true + * Default: false * Group: advanced * * @param noErrorHandler the value to set
