This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch cjmamo-CAMEL-19985 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3df0f6a9c6b309b53c4ffacfc8c3e79f4d6a6c2e Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jun 3 11:09:06 2024 +0200 CAMEL-19985: Smooks component --- .../apache/camel/catalog/components/smooks.json | 8 +- components/camel-smooks/pom.xml | 30 +- .../camel/component/smooks/SmooksProcessor.java | 33 --- .../modules/ROOT/examples/json/smooks.json | 1 + .../modules/ROOT/pages/smooks-component.adoc | 1 + .../component/ComponentsBuilderFactory.java | 5 +- .../dsl/SmooksComponentBuilderFactory.java | 8 +- .../builder/endpoint/StaticEndpointBuilders.java | 30 +- .../endpoint/dsl/SmooksEndpointBuilderFactory.java | 33 ++- .../apache/camel/kotlin/components/SmooksUriDsl.kt | 329 +++++++++++++++++++++ parent/pom.xml | 1 + 11 files changed, 389 insertions(+), 90 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json index cb677a24991..993bf295f63 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json @@ -3,10 +3,10 @@ "kind": "component", "name": "smooks", "title": "Smooks", - "description": "Applies fragment-based processing in Smooks to perform a variety of operations like transformation.", + "description": "EDI, XML, CSV, etc. based data transformation using Smooks.", "deprecated": false, "firstVersion": "4.7.0", - "label": "file", + "label": "transformation", "javaType": "org.apache.camel.component.smooks.SmooksComponent", "supportLevel": "Preview", "groupId": "org.apache.camel", @@ -14,7 +14,7 @@ "version": "4.7.0-SNAPSHOT", "scheme": "smooks", "extendsScheme": "", - "syntax": "smooks:\/\/smooks-config-path", + "syntax": "smooks:smooksConfig", "async": false, "api": false, "consumerOnly": false, @@ -28,7 +28,7 @@ "autowiredEnabled": { "index": 2, "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 [...] }, "properties": { - "database": { "index": 0, "kind": "path", "displayName": "Database", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "database name" }, + "smooksConfig": { "index": 0, "kind": "path", "displayName": "Smooks Config", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Smooks XML configuration file" }, "sendEmptyMessageWhenIdle": { "index": 1, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "bridgeErrorHandler": { "index": 2, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] "exceptionHandler": { "index": 3, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] diff --git a/components/camel-smooks/pom.xml b/components/camel-smooks/pom.xml index 4128c93c996..fe2c481934c 100644 --- a/components/camel-smooks/pom.xml +++ b/components/camel-smooks/pom.xml @@ -17,7 +17,8 @@ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -33,16 +34,12 @@ <name>Camel :: Smooks :: Parent</name> <description>Camel Smooks Component</description> - <properties> - <smooks.version>2.0.0-RC4</smooks.version> - </properties> - <dependencyManagement> <dependencies> <dependency> <groupId>org.smooks</groupId> <artifactId>smooks-bom</artifactId> - <version>${smooks.version}</version> + <version>${smooks-version}</version> <type>pom</type> <scope>import</scope> </dependency> @@ -50,22 +47,20 @@ </dependencyManagement> <dependencies> - <dependency> - <groupId>org.smooks</groupId> - <artifactId>smooks-core</artifactId> - </dependency> + <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-file</artifactId> + <artifactId>camel-support</artifactId> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-attachments</artifactId> + <artifactId>camel-file</artifactId> </dependency> <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-support</artifactId> + <groupId>org.smooks</groupId> + <artifactId>smooks-core</artifactId> </dependency> + <dependency> <groupId>org.smooks.cartridges.edi</groupId> <artifactId>smooks-edi-cartridge</artifactId> @@ -81,10 +76,15 @@ <artifactId>camel-test-junit5</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-attachments</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>org.xmlunit</groupId> <artifactId>xmlunit-core</artifactId> - <version>2.9.1</version> + <version>${xmlunit-version}</version> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java index a6abc57aa1c..259c7072ae3 100644 --- a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java +++ b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java @@ -39,8 +39,6 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.WrappedFile; -import org.apache.camel.attachment.Attachment; -import org.apache.camel.attachment.AttachmentMessage; import org.apache.camel.support.ResourceHelper; import org.apache.camel.support.service.ServiceSupport; import org.apache.camel.util.IOHelper; @@ -74,7 +72,6 @@ public class SmooksProcessor extends ServiceSupport implements Processor, CamelC private final Set<VisitorAppender> visitorAppender = new HashSet<>(); private final Map<String, Visitor> selectorVisitorMap = new HashMap<>(); private CamelContext camelContext; - private boolean attachmentsSupported; public SmooksProcessor(final CamelContext camelContext) { this.camelContext = camelContext; @@ -99,18 +96,6 @@ public class SmooksProcessor extends ServiceSupport implements Processor, CamelC } public void process(final Exchange exchange) { - //forward headers - exchange.getMessage().setHeaders(exchange.getIn().getHeaders()); - - if (attachmentsSupported) { - //forward attachments - if (exchange.getIn(AttachmentMessage.class).hasAttachments()) { - for (Entry<String, Attachment> attachmentObject : exchange.getIn(AttachmentMessage.class).getAttachmentObjects().entrySet()) { - exchange.getMessage(AttachmentMessage.class).addAttachmentObject(attachmentObject.getKey(), attachmentObject.getValue()); - } - } - } - final ExecutionContext executionContext = smooks.createExecutionContext(); try { executionContext.put(EXCHANGE_TYPED_KEY, exchange); @@ -253,24 +238,6 @@ public class SmooksProcessor extends ServiceSupport implements Processor, CamelC addAppender(smooks, visitorAppender); addVisitor(smooks, selectorVisitorMap); - InputStream inputStream = null; - try { - inputStream = camelContext.getClassResolver().loadResourceAsStream("META-INF/services/org/apache/camel/other.properties"); - if (inputStream != null) { - final Properties properties = new Properties(); - properties.load(inputStream); - if (properties.getProperty("name") != null && properties.getProperty("name").equals("attachments")) { - attachmentsSupported = true; - } - } - } finally { - if (!attachmentsSupported) { - LOG.warn("Attachments module could not be found: attachments will not be propagated"); - } - if (inputStream != null) { - inputStream.close(); - } - } } catch (Exception e) { throw new SmooksException(e.getMessage(), e); } diff --git a/docs/components/modules/ROOT/examples/json/smooks.json b/docs/components/modules/ROOT/examples/json/smooks.json new file mode 120000 index 00000000000..2b181dead66 --- /dev/null +++ b/docs/components/modules/ROOT/examples/json/smooks.json @@ -0,0 +1 @@ +../../../../../../components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/component/smooks/smooks.json \ No newline at end of file diff --git a/docs/components/modules/ROOT/pages/smooks-component.adoc b/docs/components/modules/ROOT/pages/smooks-component.adoc new file mode 120000 index 00000000000..07c7d3d61bb --- /dev/null +++ b/docs/components/modules/ROOT/pages/smooks-component.adoc @@ -0,0 +1 @@ +../../../../../components/camel-smooks/src/main/docs/smooks-component.adoc \ No newline at end of file diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index 5f699878c50..2800a975d0d 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -3857,10 +3857,9 @@ public interface ComponentsBuilderFactory { } /** * Smooks (camel-smooks) - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * - * Category: file + * Category: transformation * Since: 4.7 * Maven coordinates: org.apache.camel:camel-smooks * diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmooksComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmooksComponentBuilderFactory.java index 1e9b50ea171..46ef98ed132 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmooksComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmooksComponentBuilderFactory.java @@ -24,8 +24,7 @@ import org.apache.camel.builder.component.ComponentBuilder; import org.apache.camel.component.smooks.SmooksComponent; /** - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * * Generated by camel build tools - do NOT edit this file! */ @@ -34,10 +33,9 @@ public interface SmooksComponentBuilderFactory { /** * Smooks (camel-smooks) - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * - * Category: file + * Category: transformation * Since: 4.7 * Maven coordinates: org.apache.camel:camel-smooks * diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index dad93cb86c3..6df28f8a170 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -13037,19 +13037,20 @@ public class StaticEndpointBuilders { } /** * Smooks (camel-smooks) - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * - * Category: file + * Category: transformation * Since: 4.7 * Maven coordinates: org.apache.camel:camel-smooks * - * Syntax: <code>smooks://smooks-config-path</code> + * Syntax: <code>smooks:smooksConfig</code> * - * Path parameter: database (required) - * database name + * Path parameter: smooksConfig (required) + * Smooks XML configuration file + * This option can also be loaded from an existing file, by prefixing with + * file: or classpath: followed by the location of the file. * - * @param path smooks-config-path + * @param path smooksConfig * @return the dsl builder */ public static SmooksEndpointBuilderFactory.SmooksEndpointBuilder smooks(String path) { @@ -13057,21 +13058,22 @@ public class StaticEndpointBuilders { } /** * Smooks (camel-smooks) - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * - * Category: file + * Category: transformation * Since: 4.7 * Maven coordinates: org.apache.camel:camel-smooks * - * Syntax: <code>smooks://smooks-config-path</code> + * Syntax: <code>smooks:smooksConfig</code> * - * Path parameter: database (required) - * database name + * Path parameter: smooksConfig (required) + * Smooks XML configuration file + * This option can also be loaded from an existing file, by prefixing with + * file: or classpath: followed by the location of the file. * * @param componentName to use a custom component name for the endpoint * instead of the default name - * @param path smooks-config-path + * @param path smooksConfig * @return the dsl builder */ public static SmooksEndpointBuilderFactory.SmooksEndpointBuilder smooks(String componentName, String path) { diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java index f1fef38d77a..f4825a11130 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java @@ -27,8 +27,7 @@ import org.apache.camel.builder.EndpointProducerBuilder; import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; /** - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * * Generated by camel build tools - do NOT edit this file! */ @@ -794,19 +793,20 @@ public interface SmooksEndpointBuilderFactory { public interface SmooksBuilders { /** * Smooks (camel-smooks) - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * - * Category: file + * Category: transformation * Since: 4.7 * Maven coordinates: org.apache.camel:camel-smooks * - * Syntax: <code>smooks://smooks-config-path</code> + * Syntax: <code>smooks:smooksConfig</code> * - * Path parameter: database (required) - * database name + * Path parameter: smooksConfig (required) + * Smooks XML configuration file + * This option can also be loaded from an existing file, by prefixing + * with file: or classpath: followed by the location of the file. * - * @param path smooks-config-path + * @param path smooksConfig * @return the dsl builder */ default SmooksEndpointBuilder smooks(String path) { @@ -814,21 +814,22 @@ public interface SmooksEndpointBuilderFactory { } /** * Smooks (camel-smooks) - * Applies fragment-based processing in Smooks to perform a variety of - * operations like transformation. + * EDI, XML, CSV, etc. based data transformation using Smooks. * - * Category: file + * Category: transformation * Since: 4.7 * Maven coordinates: org.apache.camel:camel-smooks * - * Syntax: <code>smooks://smooks-config-path</code> + * Syntax: <code>smooks:smooksConfig</code> * - * Path parameter: database (required) - * database name + * Path parameter: smooksConfig (required) + * Smooks XML configuration file + * This option can also be loaded from an existing file, by prefixing + * with file: or classpath: followed by the location of the file. * * @param componentName to use a custom component name for the endpoint * instead of the default name - * @param path smooks-config-path + * @param path smooksConfig * @return the dsl builder */ default SmooksEndpointBuilder smooks(String componentName, String path) { diff --git a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/SmooksUriDsl.kt b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/SmooksUriDsl.kt new file mode 100644 index 00000000000..7e2f42edb6b --- /dev/null +++ b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/SmooksUriDsl.kt @@ -0,0 +1,329 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.kotlin.components + +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Unit +import org.apache.camel.kotlin.CamelDslMarker +import org.apache.camel.kotlin.UriDsl + +/** + * EDI, XML, CSV, etc. based data transformation using Smooks. + */ +public fun UriDsl.smooks(i: SmooksUriDsl.() -> Unit) { + SmooksUriDsl(this).apply(i) +} + +@CamelDslMarker +public class SmooksUriDsl( + it: UriDsl, +) { + private val it: UriDsl + + init { + this.it = it + this.it.component("smooks") + } + + private var smooksConfig: String = "" + + /** + * Smooks XML configuration file + */ + public fun smooksConfig(smooksConfig: String) { + this.smooksConfig = smooksConfig + it.url("$smooksConfig") + } + + /** + * If the polling consumer did not poll any files, you can enable this option to send an empty + * message (no body) instead. + */ + public fun sendEmptyMessageWhenIdle(sendEmptyMessageWhenIdle: String) { + it.property("sendEmptyMessageWhenIdle", sendEmptyMessageWhenIdle) + } + + /** + * If the polling consumer did not poll any files, you can enable this option to send an empty + * message (no body) instead. + */ + public fun sendEmptyMessageWhenIdle(sendEmptyMessageWhenIdle: Boolean) { + it.property("sendEmptyMessageWhenIdle", sendEmptyMessageWhenIdle.toString()) + } + + /** + * Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions + * (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the + * likes, will now be processed as a message and handled by the routing Error Handler. Important: + * This is only possible if the 3rd party component allows Camel to be alerted if an exception was + * thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not + * possible. In other situations we may improve the Camel component to hook into the 3rd party + * component and make this possible for future releases. By default the consumer will use the + * org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or + * ERROR level and ignored. + */ + public fun bridgeErrorHandler(bridgeErrorHandler: String) { + it.property("bridgeErrorHandler", bridgeErrorHandler) + } + + /** + * Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions + * (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the + * likes, will now be processed as a message and handled by the routing Error Handler. Important: + * This is only possible if the 3rd party component allows Camel to be alerted if an exception was + * thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not + * possible. In other situations we may improve the Camel component to hook into the 3rd party + * component and make this possible for future releases. By default the consumer will use the + * org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or + * ERROR level and ignored. + */ + public fun bridgeErrorHandler(bridgeErrorHandler: Boolean) { + it.property("bridgeErrorHandler", bridgeErrorHandler.toString()) + } + + /** + * To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is + * enabled then this option is not in use. By default the consumer will deal with exceptions, that + * will be logged at WARN or ERROR level and ignored. + */ + public fun exceptionHandler(exceptionHandler: String) { + it.property("exceptionHandler", exceptionHandler) + } + + /** + * Sets the exchange pattern when the consumer creates an exchange. + */ + public fun exchangePattern(exchangePattern: String) { + it.property("exchangePattern", exchangePattern) + } + + /** + * A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom + * implementation to control error handling usually occurred during the poll operation before an + * Exchange have been created and being routed in Camel. + */ + public fun pollStrategy(pollStrategy: String) { + it.property("pollStrategy", pollStrategy) + } + + /** + * 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 during starting and cause the route to fail being started. By deferring this startup to be + * lazy then the startup failure can be handled during routing messages via Camel's routing error + * handlers. Beware that when the first message is processed then creating and starting the producer + * may take a little time and prolong the total processing time of the processing. + */ + public fun lazyStartProducer(lazyStartProducer: String) { + it.property("lazyStartProducer", lazyStartProducer) + } + + /** + * 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 during starting and cause the route to fail being started. By deferring this startup to be + * lazy then the startup failure can be handled during routing messages via Camel's routing error + * handlers. Beware that when the first message is processed then creating and starting the producer + * may take a little time and prolong the total processing time of the processing. + */ + public fun lazyStartProducer(lazyStartProducer: Boolean) { + it.property("lazyStartProducer", lazyStartProducer.toString()) + } + + /** + * The number of subsequent error polls (failed due some error) that should happen before the + * backoffMultipler should kick-in. + */ + public fun backoffErrorThreshold(backoffErrorThreshold: String) { + it.property("backoffErrorThreshold", backoffErrorThreshold) + } + + /** + * The number of subsequent error polls (failed due some error) that should happen before the + * backoffMultipler should kick-in. + */ + public fun backoffErrorThreshold(backoffErrorThreshold: Int) { + it.property("backoffErrorThreshold", backoffErrorThreshold.toString()) + } + + /** + * The number of subsequent idle polls that should happen before the backoffMultipler should + * kick-in. + */ + public fun backoffIdleThreshold(backoffIdleThreshold: String) { + it.property("backoffIdleThreshold", backoffIdleThreshold) + } + + /** + * The number of subsequent idle polls that should happen before the backoffMultipler should + * kick-in. + */ + public fun backoffIdleThreshold(backoffIdleThreshold: Int) { + it.property("backoffIdleThreshold", backoffIdleThreshold.toString()) + } + + /** + * To let the scheduled polling consumer backoff if there has been a number of subsequent + * idles/errors in a row. The multiplier is then the number of polls that will be skipped before the + * next actual attempt is happening again. When this option is in use then backoffIdleThreshold + * and/or backoffErrorThreshold must also be configured. + */ + public fun backoffMultiplier(backoffMultiplier: String) { + it.property("backoffMultiplier", backoffMultiplier) + } + + /** + * To let the scheduled polling consumer backoff if there has been a number of subsequent + * idles/errors in a row. The multiplier is then the number of polls that will be skipped before the + * next actual attempt is happening again. When this option is in use then backoffIdleThreshold + * and/or backoffErrorThreshold must also be configured. + */ + public fun backoffMultiplier(backoffMultiplier: Int) { + it.property("backoffMultiplier", backoffMultiplier.toString()) + } + + /** + * Milliseconds before the next poll. + */ + public fun delay(delay: String) { + it.property("delay", delay) + } + + /** + * Milliseconds before the next poll. + */ + public fun delay(delay: Int) { + it.property("delay", delay.toString()) + } + + /** + * If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the + * previous run polled 1 or more messages. + */ + public fun greedy(greedy: String) { + it.property("greedy", greedy) + } + + /** + * If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the + * previous run polled 1 or more messages. + */ + public fun greedy(greedy: Boolean) { + it.property("greedy", greedy.toString()) + } + + /** + * Milliseconds before the first poll starts. + */ + public fun initialDelay(initialDelay: String) { + it.property("initialDelay", initialDelay) + } + + /** + * Milliseconds before the first poll starts. + */ + public fun initialDelay(initialDelay: Int) { + it.property("initialDelay", initialDelay.toString()) + } + + /** + * Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only + * fire once. If you set it to 5, it will only fire five times. A value of zero or negative means + * fire forever. + */ + public fun repeatCount(repeatCount: String) { + it.property("repeatCount", repeatCount) + } + + /** + * Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only + * fire once. If you set it to 5, it will only fire five times. A value of zero or negative means + * fire forever. + */ + public fun repeatCount(repeatCount: Int) { + it.property("repeatCount", repeatCount.toString()) + } + + /** + * The consumer logs a start/complete log line when it polls. This option allows you to configure + * the logging level for that. + */ + public fun runLoggingLevel(runLoggingLevel: String) { + it.property("runLoggingLevel", runLoggingLevel) + } + + /** + * Allows for configuring a custom/shared thread pool to use for the consumer. By default each + * consumer has its own single threaded thread pool. + */ + public fun scheduledExecutorService(scheduledExecutorService: String) { + it.property("scheduledExecutorService", scheduledExecutorService) + } + + /** + * To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or + * quartz for built in scheduler + */ + public fun scheduler(scheduler: String) { + it.property("scheduler", scheduler) + } + + /** + * To configure additional properties when using a custom scheduler or any of the Quartz, Spring + * based scheduler. + */ + public fun schedulerProperties(schedulerProperties: String) { + it.property("schedulerProperties", schedulerProperties) + } + + /** + * Whether the scheduler should be auto started. + */ + public fun startScheduler(startScheduler: String) { + it.property("startScheduler", startScheduler) + } + + /** + * Whether the scheduler should be auto started. + */ + public fun startScheduler(startScheduler: Boolean) { + it.property("startScheduler", startScheduler.toString()) + } + + /** + * Time unit for initialDelay and delay options. + */ + public fun timeUnit(timeUnit: String) { + it.property("timeUnit", timeUnit) + } + + /** + * Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. + */ + public fun useFixedDelay(useFixedDelay: String) { + it.property("useFixedDelay", useFixedDelay) + } + + /** + * Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. + */ + public fun useFixedDelay(useFixedDelay: Boolean) { + it.property("useFixedDelay", useFixedDelay.toString()) + } +} diff --git a/parent/pom.xml b/parent/pom.xml index 00df68bb3d5..87c8ccd0dc3 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -439,6 +439,7 @@ <smallrye-health-version>4.1.0</smallrye-health-version> <smallrye-fault-tolerance-version>6.3.0</smallrye-fault-tolerance-version> <smbj-version>0.13.0</smbj-version> + <smooks-version>2.0.0-RC4</smooks-version> <snakeyaml-version>2.2</snakeyaml-version> <snakeyaml-engine-version>2.7</snakeyaml-engine-version> <snmp4j-version>3.8.2</snmp4j-version>
