From 321aa1063dad55cc67af96b7385674483b6da7d2 Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:27:17 +0200 Subject: [PATCH 1/9] Add camel-camunda-starter camel-camunda has been in Camel core since 4.19.0 but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test that verifies camel.component.camunda.* Spring Boot properties are copied onto the CamundaComponent bean by the starter. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../catalog/components/camunda.json | 58 +++++ .../camel-camunda-starter/pom.xml | 48 +++++ .../src/main/docs/camunda.json | 98 +++++++++ .../CamundaComponentAutoConfiguration.java | 74 +++++++ .../CamundaComponentConfiguration.java | 182 ++++++++++++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 17 ++ ...CamundaComponentAutoConfigurationTest.java | 57 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/starters/camunda.adoc | 42 ++++ .../camel-spring-boot-dependencies/pom.xml | 10 + 14 files changed, 803 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/camunda.json create mode 100644 components-starter/camel-camunda-starter/pom.xml create mode 100644 components-starter/camel-camunda-starter/src/main/docs/camunda.json create mode 100644 components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfiguration.java create mode 100644 components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentConfiguration.java create mode 100644 components-starter/camel-camunda-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-camunda-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-camunda-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-camunda-starter/src/test/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/camunda.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index 09fffc8e95ee..e466750012a4 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -73,6 +73,7 @@ braintree browse caffeine-cache caffeine-loadcache +camunda chatscript chunk class diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/camunda.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/camunda.json new file mode 100644 index 000000000000..38eb86119061 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/camunda.json @@ -0,0 +1,58 @@ +{ + "component": { + "kind": "component", + "name": "camunda", + "title": "Camunda", + "description": "Interact with Camunda 8 Orchestration Clusters using the Camunda Java Client.", + "deprecated": false, + "firstVersion": "4.19.0", + "label": "workflow,saas", + "javaType": "org.apache.camel.component.camunda.CamundaComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-camunda-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "camunda", + "extendsScheme": "", + "syntax": "camunda:operationName", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": false, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "grpcAddress": { "index": 0, "kind": "property", "displayName": "Grpc Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "http:\/\/localhost:26500", "description": "gRPC address of the Camunda cluster (e.g. http:\/\/localhost:26500). Used for self-managed connections when clusterId is not set." }, + "restAddress": { "index": 1, "kind": "property", "displayName": "Rest Address", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "http:\/\/localhost:8080", "description": "REST address of the Camunda cluster (e.g. http:\/\/localhost:8080). Used for self-managed connections when clusterId is not set." }, + "bridgeErrorHandler": { "index": 2, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "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 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." }, + "lazyStartProducer": { "index": 3, "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 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." }, + "autowiredEnabled": { "index": 4, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." }, + "clientId": { "index": 5, "kind": "property", "displayName": "Client Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Client ID for OAuth \/ SaaS authentication." }, + "clientSecret": { "index": 6, "kind": "property", "displayName": "Client Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Client secret for OAuth \/ SaaS authentication." }, + "clusterId": { "index": 7, "kind": "property", "displayName": "Cluster Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Camunda SaaS cluster ID. When set, the client connects via the cloud builder." }, + "oAuthAPI": { "index": 8, "kind": "property", "displayName": "OAuth API", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "OAuth authorization server URL for self-managed authentication." }, + "region": { "index": 9, "kind": "property", "displayName": "Region", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "bru-2", "description": "Camunda SaaS region (default: bru-2)." } + }, + "headers": { + "CamelCamundaJobKey": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Job key for the worker job", "constantName": "org.apache.camel.component.camunda.CamundaConstants#JOB_KEY" }, + "CamelCamundaResourceName": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Resource name for deploy operation", "constantName": "org.apache.camel.component.camunda.CamundaConstants#RESOURCE_NAME" }, + "CamelCamundaIsSuccess": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Indicates if the operation was successful", "constantName": "org.apache.camel.component.camunda.CamundaConstants#IS_SUCCESS" }, + "CamelCamundaErrorMessage": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Error message if operation failed", "constantName": "org.apache.camel.component.camunda.CamundaConstants#ERROR_MESSAGE" }, + "CamelCamundaErrorCode": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Error code if operation failed", "constantName": "org.apache.camel.component.camunda.CamundaConstants#ERROR_CODE" }, + "CamelCamundaBPMNProcessId": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The process ID of a deployed process", "constantName": "org.apache.camel.component.camunda.CamundaConstants#BPMN_PROCESS_ID" }, + "CamelCamundaVersion": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The version of a deployed process", "constantName": "org.apache.camel.component.camunda.CamundaConstants#VERSION" }, + "CamelCamundaProcessDefinitionKey": { "index": 7, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The process definition key of a deployed process", "constantName": "org.apache.camel.component.camunda.CamundaConstants#PROCESS_DEFINITION_KEY" } + }, + "properties": { + "operationName": { "index": 0, "kind": "path", "displayName": "Operation Name", "group": "common", "label": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.component.camunda.internal.OperationName", "enum": [ "startProcess", "cancelProcess", "publishMessage", "completeJob", "failJob", "updateJobRetries", "worker", "throwError", "deployResource" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to use" }, + "formatJSON": { "index": 1, "kind": "parameter", "displayName": "Format JSON", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "Format the result in the body as JSON." }, + "jobType": { "index": 2, "kind": "parameter", "displayName": "Job Type", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Job type for the job worker." }, + "timeout": { "index": 3, "kind": "parameter", "displayName": "Timeout", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": 10, "description": "Timeout for job worker in seconds." }, + "bridgeErrorHandler": { "index": 4, "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 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." }, + "exceptionHandler": { "index": 5, "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 default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, + "exchangePattern": { "index": 6, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, + "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 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." } + } +} diff --git a/components-starter/camel-camunda-starter/pom.xml b/components-starter/camel-camunda-starter/pom.xml new file mode 100644 index 000000000000..d0ed46721ba0 --- /dev/null +++ b/components-starter/camel-camunda-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-camunda-starter + jar + Camel SB Starters :: camunda + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-camunda + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-camunda-starter/src/main/docs/camunda.json b/components-starter/camel-camunda-starter/src/main/docs/camunda.json new file mode 100644 index 000000000000..c82cada8c514 --- /dev/null +++ b/components-starter/camel-camunda-starter/src/main/docs/camunda.json @@ -0,0 +1,98 @@ +{ + "groups": [ + { + "name": "camel.component.camunda", + "type": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration" + }, + { + "name": "camel.component.camunda.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.camunda.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.camunda.bridge-error-handler", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.camunda.client-id", + "type": "java.lang.String", + "description": "Client ID for OAuth \/ SaaS authentication.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration" + }, + { + "name": "camel.component.camunda.client-secret", + "type": "java.lang.String", + "description": "Client secret for OAuth \/ SaaS authentication.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration" + }, + { + "name": "camel.component.camunda.cluster-id", + "type": "java.lang.String", + "description": "Camunda SaaS cluster ID. When set, the client connects via the cloud builder.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration" + }, + { + "name": "camel.component.camunda.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.camunda.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the camunda component. This is enabled by default.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration" + }, + { + "name": "camel.component.camunda.grpc-address", + "type": "java.lang.String", + "description": "gRPC address of the Camunda cluster (e.g. http:\/\/localhost:26500). Used for self-managed connections when clusterId is not set.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "defaultValue": "http:\/\/localhost:26500" + }, + { + "name": "camel.component.camunda.lazy-start-producer", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.camunda.o-auth-a-p-i", + "type": "java.lang.String", + "description": "OAuth authorization server URL for self-managed authentication.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration" + }, + { + "name": "camel.component.camunda.region", + "type": "java.lang.String", + "description": "Camunda SaaS region (default: bru-2).", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "defaultValue": "bru-2" + }, + { + "name": "camel.component.camunda.rest-address", + "type": "java.lang.String", + "description": "REST address of the Camunda cluster (e.g. http:\/\/localhost:8080). Used for self-managed connections when clusterId is not set.", + "sourceType": "org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration", + "defaultValue": "http:\/\/localhost:8080" + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfiguration.java b/components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfiguration.java new file mode 100644 index 000000000000..e6a9f052cee7 --- /dev/null +++ b/components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.camunda.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.camunda.CamundaComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = CamelAutoConfiguration.class) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,CamundaComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.camunda"}) +public class CamundaComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final CamundaComponentConfiguration configuration; + + public CamundaComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.camunda.springboot.CamundaComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureCamundaComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.camunda", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.camunda.customizer") + && target instanceof CamundaComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentConfiguration.java b/components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentConfiguration.java new file mode 100644 index 000000000000..66d1695a7563 --- /dev/null +++ b/components-starter/camel-camunda-starter/src/main/java/org/apache/camel/component/camunda/springboot/CamundaComponentConfiguration.java @@ -0,0 +1,182 @@ +/* + * 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.component.camunda.springboot; + +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Interact with Camunda 8 Orchestration Clusters using the Camunda Java Client. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.camunda") +public class CamundaComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the camunda component. This is + * enabled by default. + */ + private Boolean enabled; + /** + * gRPC address of the Camunda cluster (e.g. http://localhost:26500). Used + * for self-managed connections when clusterId is not set. + */ + private String grpcAddress = "http://localhost:26500"; + /** + * REST address of the Camunda cluster (e.g. http://localhost:8080). Used + * for self-managed connections when clusterId is not set. + */ + private String restAddress = "http://localhost:8080"; + /** + * 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. + */ + private Boolean bridgeErrorHandler = false; + /** + * 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. + */ + private Boolean lazyStartProducer = false; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + /** + * Client ID for OAuth / SaaS authentication. + */ + private String clientId; + /** + * Client secret for OAuth / SaaS authentication. + */ + private String clientSecret; + /** + * Camunda SaaS cluster ID. When set, the client connects via the cloud + * builder. + */ + private String clusterId; + /** + * OAuth authorization server URL for self-managed authentication. + */ + private String oAuthAPI; + /** + * Camunda SaaS region (default: bru-2). + */ + private String region = "bru-2"; + + public String getGrpcAddress() { + return grpcAddress; + } + + public void setGrpcAddress(String grpcAddress) { + this.grpcAddress = grpcAddress; + } + + public String getRestAddress() { + return restAddress; + } + + public void setRestAddress(String restAddress) { + this.restAddress = restAddress; + } + + public Boolean getBridgeErrorHandler() { + return bridgeErrorHandler; + } + + public void setBridgeErrorHandler(Boolean bridgeErrorHandler) { + this.bridgeErrorHandler = bridgeErrorHandler; + } + + public Boolean getLazyStartProducer() { + return lazyStartProducer; + } + + public void setLazyStartProducer(Boolean lazyStartProducer) { + this.lazyStartProducer = lazyStartProducer; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public String getClusterId() { + return clusterId; + } + + public void setClusterId(String clusterId) { + this.clusterId = clusterId; + } + + public String getOAuthAPI() { + return oAuthAPI; + } + + public void setOAuthAPI(String oAuthAPI) { + this.oAuthAPI = oAuthAPI; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } +} \ No newline at end of file diff --git a/components-starter/camel-camunda-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-camunda-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-camunda-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-camunda-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-camunda-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-camunda-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-camunda-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-camunda-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..07dd2ed54e10 --- /dev/null +++ b/components-starter/camel-camunda-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,17 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.camunda.springboot.CamundaComponentAutoConfiguration diff --git a/components-starter/camel-camunda-starter/src/test/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfigurationTest.java b/components-starter/camel-camunda-starter/src/test/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..a97285f057ba --- /dev/null +++ b/components-starter/camel-camunda-starter/src/test/java/org/apache/camel/component/camunda/springboot/CamundaComponentAutoConfigurationTest.java @@ -0,0 +1,57 @@ +/* + * 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.component.camunda.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.camunda.CamundaComponent; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, CamundaComponentAutoConfiguration.class }, + properties = { + "camel.component.camunda.grpc-address = http://localhost:26500", + "camel.component.camunda.rest-address = http://localhost:8080", + "camel.component.camunda.client-id = demo-client", + "camel.component.camunda.region = demo-region" }) +public class CamundaComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + CamundaComponent component = assertInstanceOf(CamundaComponent.class, context.getComponent("camunda")); + + // set through camel.component.camunda.*, so this asserts the Spring Boot + // properties are copied onto the component by the starter + assertEquals("http://localhost:26500", component.getGrpcAddress()); + assertEquals("http://localhost:8080", component.getRestAddress()); + assertEquals("demo-client", component.getClientId()); + assertEquals("demo-region", component.getRegion()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index fbcfc75fbd4a..34beebd88a0a 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -182,6 +182,7 @@ camel-braintree-starter camel-browse-starter camel-caffeine-starter + camel-camunda-starter camel-cassandraql-starter camel-cbor-starter camel-chatscript-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index 442e36d43693..180b006a4a0f 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -81,6 +81,7 @@ ** xref:starters/braintree.adoc[Braintree] ** xref:starters/browse.adoc[Browse] ** xref:starters/caffeine.adoc[Caffeine Cache] +** xref:starters/camunda.adoc[Camunda] ** xref:starters/cassandraql.adoc[Cassandra CQL] ** xref:starters/cbor.adoc[CBOR] ** xref:starters/chatscript.adoc[ChatScript] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/camunda.adoc b/docs/spring-boot/modules/ROOT/pages/starters/camunda.adoc new file mode 100644 index 000000000000..6ed6709c8ed6 --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/camunda.adoc @@ -0,0 +1,42 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += Camunda +:artifactid: camel-camunda-starter + +Interact with Camunda 8 Orchestration Clusters using the Camunda Java Client. + +== What's inside + +* xref:{csb-camel-components}::camunda-component.adoc[Camunda component], URI syntax: `camunda:operationName` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-camunda-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 11 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.camunda.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.camunda.bridge-error-handler | 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. | false | Boolean +| camel.component.camunda.client-id | Client ID for OAuth / SaaS authentication. | | String +| camel.component.camunda.client-secret | Client secret for OAuth / SaaS authentication. | | String +| camel.component.camunda.cluster-id | Camunda SaaS cluster ID. When set, the client connects via the cloud builder. | | String +| camel.component.camunda.enabled | Whether to enable auto configuration of the camunda component. This is enabled by default. | | Boolean +| camel.component.camunda.grpc-address | gRPC address of the Camunda cluster (e.g. http://localhost:26500). Used for self-managed connections when clusterId is not set. | http://localhost:26500 | String +| camel.component.camunda.lazy-start-producer | 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. | false | Boolean +| camel.component.camunda.o-auth-a-p-i | OAuth authorization server URL for self-managed authentication. | | String +| camel.component.camunda.region | Camunda SaaS region (default: bru-2). | bru-2 | String +| camel.component.camunda.rest-address | REST address of the Camunda cluster (e.g. http://localhost:8080). Used for self-managed connections when clusterId is not set. | http://localhost:8080 | String +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 1b76dd5af13b..9fd532935b5a 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -65,6 +65,11 @@ sls20201230 5.18.1 + + com.aliyun + tea + 1.4.2 + com.aliyun tea-openapi @@ -732,6 +737,11 @@ camel-caffeine-starter ${project.version} + + org.apache.camel.springboot + camel-camunda-starter + ${project.version} + org.apache.camel.springboot camel-cassandraql-starter From 6609f8ce8790cb17884099e07121b3837c51332b Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:37:30 +0200 Subject: [PATCH 2/9] Add camel-event-starter camel-event allows subscribing to Camel internal events (route and exchange events) but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test verifying camel.component.event.* Spring Boot properties are copied onto the CamelEventComponent bean. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../springboot/catalog/components/event.json | 57 +++++ .../camel-event-starter/pom.xml | 48 +++++ .../src/main/docs/event.json | 46 ++++ .../CamelEventComponentAutoConfiguration.java | 74 +++++++ .../CamelEventComponentConfiguration.java | 77 +++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 17 ++ ...elEventComponentAutoConfigurationTest.java | 54 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/starters/event.adoc | 34 +++ .../camel-spring-boot-dependencies/pom.xml | 5 + 14 files changed, 629 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/event.json create mode 100644 components-starter/camel-event-starter/pom.xml create mode 100644 components-starter/camel-event-starter/src/main/docs/event.json create mode 100644 components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfiguration.java create mode 100644 components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentConfiguration.java create mode 100644 components-starter/camel-event-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-event-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-event-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-event-starter/src/test/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/event.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index e466750012a4..cb45395639ee 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -123,6 +123,7 @@ dynamic-router-control ehcache elasticsearch elasticsearch-rest-client +event exec fhir file diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/event.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/event.json new file mode 100644 index 000000000000..7a7cd6a1c079 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/event.json @@ -0,0 +1,57 @@ +{ + "component": { + "kind": "component", + "name": "event", + "title": "Event", + "description": "Subscribe to Camel internal events such as route started\/stopped and exchange completed\/failed.", + "deprecated": false, + "firstVersion": "4.19.0", + "label": "core,monitoring", + "javaType": "org.apache.camel.component.camelevent.CamelEventComponent", + "supportLevel": "Stable", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-event-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "event", + "extendsScheme": "", + "syntax": "event:events", + "async": false, + "api": false, + "consumerOnly": true, + "producerOnly": false, + "lenientProperties": false, + "browsable": false, + "remote": false + }, + "componentProperties": { + "bridgeErrorHandler": { "index": 0, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "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 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." }, + "autowiredEnabled": { "index": 1, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } + }, + "headers": { + "CamelEventType": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event type name (e.g., RouteStarted, ExchangeCompleted)", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_TYPE" }, + "CamelEventTimestamp": { "index": 1, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event timestamp in milliseconds since epoch (if available)", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_TIMESTAMP" }, + "CamelEventRouteId": { "index": 2, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The route ID. For route events, the route that triggered the event. For exchange events, the route the exchange originated from.", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_ROUTE_ID" }, + "CamelEventExchangeId": { "index": 3, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The exchange ID (for exchange events)", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_EXCHANGE_ID" }, + "CamelEventEndpointUri": { "index": 4, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The endpoint URI. For ExchangeSent\/ExchangeSending events, the target endpoint. For other exchange events, the from endpoint of the exchange.", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_ENDPOINT_URI" }, + "CamelEventException": { "index": 5, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The exception message from FailureEvent.getCause() (for failure events such as ExchangeFailed, RouteRestartingFailure, ServiceStartupFailure, etc.)", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_EXCEPTION" }, + "CamelEventDuration": { "index": 6, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The time taken in milliseconds for ExchangeSent events", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_DURATION" }, + "CamelEventStepId": { "index": 7, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The step ID (for step events such as StepStarted, StepCompleted, StepFailed)", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_STEP_ID" }, + "CamelEventRedeliveryAttempt": { "index": 8, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The redelivery attempt number (for ExchangeRedelivery events)", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_REDELIVERY_ATTEMPT" }, + "CamelEventBatchSize": { "index": 9, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of events in a batch (only set when batchSize is configured)", "constantName": "org.apache.camel.component.camelevent.CamelEventConstants#HEADER_EVENT_BATCH_SIZE" } + }, + "properties": { + "events": { "index": 0, "kind": "path", "displayName": "Events", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Comma-separated list of event types to subscribe to. Event types correspond to CamelEvent.Type enum values (case-insensitive), for example: RouteStarted, RouteStopped, ExchangeCompleted, ExchangeFailed. Wildcard patterns are supported using a suffix, for example: Route matches all route events, Exchange matches all exchange events, and matches all events." }, + "async": { "index": 1, "kind": "parameter", "displayName": "Async", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to process events asynchronously using a thread pool. When enabled, the event notifier thread is not blocked while the event exchange is processed. Use asyncPoolSize to control the maximum number of concurrent event processing threads." }, + "asyncPoolSize": { "index": 2, "kind": "parameter", "displayName": "Async Pool Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "The maximum number of threads in the pool for async event processing. Only used when the async option is enabled." }, + "asyncQueueSize": { "index": 3, "kind": "parameter", "displayName": "Async Queue Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "The capacity of the bounded event queue used when async is enabled. When the queue is full, the backpressure policy determines the behavior. Only used when the async option is enabled." }, + "backpressurePolicy": { "index": 4, "kind": "parameter", "displayName": "Backpressure Policy", "group": "consumer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.camelevent.BackpressurePolicy", "enum": [ "Block", "Drop", "Fail" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Block", "description": "The backpressure policy when the async event queue is full. Supported values: Block (block the event notifier thread until space is available), Drop (silently discard the event), Fail (throw an exception)." }, + "batchSize": { "index": 5, "kind": "parameter", "displayName": "Batch Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "description": "Enables event batching. When set to a value greater than 1, events are collected into a java.util.List and dispatched as a single exchange when the batch is full or the batchTimeout expires. The exchange body will be a List." }, + "batchTimeout": { "index": 6, "kind": "parameter", "displayName": "Batch Timeout", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "The maximum time in milliseconds to wait for a batch to fill before dispatching a partial batch. Only used when batchSize is greater than 1." }, + "customEventClass": { "index": 7, "kind": "parameter", "displayName": "Custom Event Class", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Fully qualified class name of a custom event class to filter on. When set, only events that are instances of the specified class will be accepted. This is useful for subscribing to custom user-defined events." }, + "exclude": { "index": 8, "kind": "parameter", "displayName": "Exclude", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Comma-separated list of route IDs to exclude. For route events, this excludes by route ID. For exchange events, this excludes by the route ID of the exchange. Events matching any of the specified route IDs will be rejected. This option can be used together with the include option." }, + "include": { "index": 9, "kind": "parameter", "displayName": "Include", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Comma-separated list of route IDs to include. For route events, this matches the route ID. For exchange events, this matches the route ID of the exchange. Only events matching one of the specified route IDs will be accepted." }, + "bridgeErrorHandler": { "index": 10, "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 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." }, + "exceptionHandler": { "index": 11, "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 default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, + "exchangePattern": { "index": 12, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." } + } +} diff --git a/components-starter/camel-event-starter/pom.xml b/components-starter/camel-event-starter/pom.xml new file mode 100644 index 000000000000..f35b42f50acf --- /dev/null +++ b/components-starter/camel-event-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-event-starter + jar + Camel SB Starters :: event + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-event + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-event-starter/src/main/docs/event.json b/components-starter/camel-event-starter/src/main/docs/event.json new file mode 100644 index 000000000000..c6de788e1694 --- /dev/null +++ b/components-starter/camel-event-starter/src/main/docs/event.json @@ -0,0 +1,46 @@ +{ + "groups": [ + { + "name": "camel.component.event", + "type": "org.apache.camel.component.camelevent.springboot.CamelEventComponentConfiguration", + "sourceType": "org.apache.camel.component.camelevent.springboot.CamelEventComponentConfiguration" + }, + { + "name": "camel.component.event.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.camelevent.springboot.CamelEventComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.event.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.camelevent.springboot.CamelEventComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.event.bridge-error-handler", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.camelevent.springboot.CamelEventComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.event.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.event.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the event component. This is enabled by default.", + "sourceType": "org.apache.camel.component.camelevent.springboot.CamelEventComponentConfiguration" + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfiguration.java b/components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfiguration.java new file mode 100644 index 000000000000..a7f6d721c0e0 --- /dev/null +++ b/components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.camelevent.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.camelevent.CamelEventComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = CamelAutoConfiguration.class) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,CamelEventComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.event"}) +public class CamelEventComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final CamelEventComponentConfiguration configuration; + + public CamelEventComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.camelevent.springboot.CamelEventComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureCamelEventComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.event", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.event.customizer") + && target instanceof CamelEventComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentConfiguration.java b/components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentConfiguration.java new file mode 100644 index 000000000000..69696c8daf86 --- /dev/null +++ b/components-starter/camel-event-starter/src/main/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentConfiguration.java @@ -0,0 +1,77 @@ +/* + * 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.component.camelevent.springboot; + +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Subscribe to Camel internal events such as route started/stopped and exchange + * completed/failed. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.event") +public class CamelEventComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the event component. This is + * enabled by default. + */ + private Boolean enabled; + /** + * 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. + */ + private Boolean bridgeErrorHandler = false; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + + public Boolean getBridgeErrorHandler() { + return bridgeErrorHandler; + } + + public void setBridgeErrorHandler(Boolean bridgeErrorHandler) { + this.bridgeErrorHandler = bridgeErrorHandler; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } +} \ No newline at end of file diff --git a/components-starter/camel-event-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-event-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-event-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-event-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-event-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-event-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-event-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-event-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..aa0c0f065e62 --- /dev/null +++ b/components-starter/camel-event-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,17 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.camelevent.springboot.CamelEventComponentAutoConfiguration diff --git a/components-starter/camel-event-starter/src/test/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfigurationTest.java b/components-starter/camel-event-starter/src/test/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..d229a6e91761 --- /dev/null +++ b/components-starter/camel-event-starter/src/test/java/org/apache/camel/component/camelevent/springboot/CamelEventComponentAutoConfigurationTest.java @@ -0,0 +1,54 @@ +/* + * 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.component.camelevent.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.camelevent.CamelEventComponent; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, CamelEventComponentAutoConfiguration.class }, + properties = { + "camel.component.event.bridge-error-handler = true", + "camel.component.event.autowired-enabled = false" }) +public class CamelEventComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + CamelEventComponent component = assertInstanceOf(CamelEventComponent.class, context.getComponent("event")); + + // set through camel.component.event.*, so this asserts the Spring Boot + // properties are copied onto the component by the starter + assertEquals(true, component.isBridgeErrorHandler()); + assertFalse(component.isAutowiredEnabled()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index 34beebd88a0a..e16f8f8cd174 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -235,6 +235,7 @@ camel-ehcache-starter camel-elasticsearch-rest-client-starter camel-elasticsearch-starter + camel-event-starter camel-exec-starter camel-fastjson-starter camel-fhir-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index 180b006a4a0f..07cada25b94e 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -134,6 +134,7 @@ ** xref:starters/ehcache.adoc[Ehcache] ** xref:starters/elasticsearch-rest-client.adoc[Elasticsearch Low level Rest Client] ** xref:starters/elasticsearch.adoc[Elasticsearch] +** xref:starters/event.adoc[Event] ** xref:starters/exec.adoc[Exec] ** xref:starters/fastjson.adoc[JSON Fastjson] ** xref:starters/fhir.adoc[FHIR] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/event.adoc b/docs/spring-boot/modules/ROOT/pages/starters/event.adoc new file mode 100644 index 000000000000..69fb63cff34c --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/event.adoc @@ -0,0 +1,34 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += Event +:artifactid: camel-event-starter + +Subscribe to Camel internal events such as route started/stopped and exchange completed/failed. + +== What's inside + +* xref:{csb-camel-components}::event-component.adoc[Event component], URI syntax: `event:events` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-event-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 3 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.event.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.event.bridge-error-handler | 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. | false | Boolean +| camel.component.event.enabled | Whether to enable auto configuration of the event component. This is enabled by default. | | Boolean +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 9fd532935b5a..15400e0c0db6 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -1027,6 +1027,11 @@ camel-endpointdsl-starter ${project.version} + + org.apache.camel.springboot + camel-event-starter + ${project.version} + org.apache.camel.springboot camel-exec-starter From a8085f01e8ea4062aace67a848bff945ade3674b Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:38:11 +0200 Subject: [PATCH 3/9] Add camel-shell-starter camel-shell provides an interactive JLine-based shell endpoint but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test verifying camel.component.shell.* Spring Boot properties are copied onto the ShellComponent bean. The component is resolved without auto-starting it, since ShellComponent.doStart() opens a real system terminal, which must not happen in a headless test run. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../springboot/catalog/components/shell.json | 39 ++++ .../camel-shell-starter/pom.xml | 48 +++++ .../src/main/docs/shell.json | 60 ++++++ .../ShellComponentAutoConfiguration.java | 74 +++++++ .../ShellComponentConfiguration.java | 100 +++++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 17 ++ .../ShellComponentAutoConfigurationTest.java | 57 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/starters/shell.adoc | 36 ++++ .../camel-spring-boot-dependencies/pom.xml | 5 + 14 files changed, 653 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/shell.json create mode 100644 components-starter/camel-shell-starter/pom.xml create mode 100644 components-starter/camel-shell-starter/src/main/docs/shell.json create mode 100644 components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfiguration.java create mode 100644 components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentConfiguration.java create mode 100644 components-starter/camel-shell-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-shell-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-shell-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-shell-starter/src/test/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/shell.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index cb45395639ee..a53f989d07b4 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -332,6 +332,7 @@ seda servicenow servlet sftp +shell sjms sjms2 slack diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/shell.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/shell.json new file mode 100644 index 000000000000..029dcf67761b --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/shell.json @@ -0,0 +1,39 @@ +{ + "component": { + "kind": "component", + "name": "shell", + "title": "Shell", + "description": "Camel Shell component", + "deprecated": false, + "firstVersion": "4.21.0", + "label": "api", + "javaType": "org.apache.camel.component.shell.ShellComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-shell-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "shell", + "extendsScheme": "", + "syntax": "shell:prompt", + "async": false, + "api": false, + "consumerOnly": true, + "producerOnly": false, + "lenientProperties": false, + "browsable": false, + "remote": false + }, + "componentProperties": { + "bridgeErrorHandler": { "index": 0, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "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 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." }, + "autowiredEnabled": { "index": 1, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." }, + "bannerResource": { "index": 2, "kind": "property", "displayName": "Banner Resource", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "camel-shell-banner.txt", "description": "Classpath resource path to a custom banner text file" }, + "showBanner": { "index": 3, "kind": "property", "displayName": "Show Banner", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to print the Camel banner on startup" } + }, + "properties": { + "prompt": { "index": 0, "kind": "path", "displayName": "Prompt", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Shell prompt" }, + "color": { "index": 1, "kind": "parameter", "displayName": "Color", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "cyan", "description": "Prompt color: black, red, green, yellow, blue, magenta, cyan, white" }, + "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 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." }, + "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 default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, + "exchangePattern": { "index": 4, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." } + } +} diff --git a/components-starter/camel-shell-starter/pom.xml b/components-starter/camel-shell-starter/pom.xml new file mode 100644 index 000000000000..00fa43710be3 --- /dev/null +++ b/components-starter/camel-shell-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-shell-starter + jar + Camel SB Starters :: shell + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-shell + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-shell-starter/src/main/docs/shell.json b/components-starter/camel-shell-starter/src/main/docs/shell.json new file mode 100644 index 000000000000..b3564911f185 --- /dev/null +++ b/components-starter/camel-shell-starter/src/main/docs/shell.json @@ -0,0 +1,60 @@ +{ + "groups": [ + { + "name": "camel.component.shell", + "type": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration", + "sourceType": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration" + }, + { + "name": "camel.component.shell.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.shell.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.shell.banner-resource", + "type": "java.lang.String", + "description": "Classpath resource path to a custom banner text file", + "sourceType": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration", + "defaultValue": "camel-shell-banner.txt" + }, + { + "name": "camel.component.shell.bridge-error-handler", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.shell.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.shell.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the shell component. This is enabled by default.", + "sourceType": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration" + }, + { + "name": "camel.component.shell.show-banner", + "type": "java.lang.Boolean", + "description": "Whether to print the Camel banner on startup", + "sourceType": "org.apache.camel.component.shell.springboot.ShellComponentConfiguration", + "defaultValue": true + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfiguration.java b/components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfiguration.java new file mode 100644 index 000000000000..6c1b4c778db5 --- /dev/null +++ b/components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.shell.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.shell.ShellComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = CamelAutoConfiguration.class) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,ShellComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.shell"}) +public class ShellComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final ShellComponentConfiguration configuration; + + public ShellComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.shell.springboot.ShellComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureShellComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.shell", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.shell.customizer") + && target instanceof ShellComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentConfiguration.java b/components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentConfiguration.java new file mode 100644 index 000000000000..d43af3b56ec2 --- /dev/null +++ b/components-starter/camel-shell-starter/src/main/java/org/apache/camel/component/shell/springboot/ShellComponentConfiguration.java @@ -0,0 +1,100 @@ +/* + * 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.component.shell.springboot; + +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Camel Shell component + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.shell") +public class ShellComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the shell component. This is + * enabled by default. + */ + private Boolean enabled; + /** + * 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. + */ + private Boolean bridgeErrorHandler = false; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + /** + * Classpath resource path to a custom banner text file + */ + private String bannerResource = "camel-shell-banner.txt"; + /** + * Whether to print the Camel banner on startup + */ + private Boolean showBanner = true; + + public Boolean getBridgeErrorHandler() { + return bridgeErrorHandler; + } + + public void setBridgeErrorHandler(Boolean bridgeErrorHandler) { + this.bridgeErrorHandler = bridgeErrorHandler; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } + + public String getBannerResource() { + return bannerResource; + } + + public void setBannerResource(String bannerResource) { + this.bannerResource = bannerResource; + } + + public Boolean getShowBanner() { + return showBanner; + } + + public void setShowBanner(Boolean showBanner) { + this.showBanner = showBanner; + } +} \ No newline at end of file diff --git a/components-starter/camel-shell-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-shell-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-shell-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-shell-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-shell-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-shell-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-shell-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-shell-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..3badc483a68a --- /dev/null +++ b/components-starter/camel-shell-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,17 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.shell.springboot.ShellComponentAutoConfiguration diff --git a/components-starter/camel-shell-starter/src/test/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfigurationTest.java b/components-starter/camel-shell-starter/src/test/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..e96d73675dc2 --- /dev/null +++ b/components-starter/camel-shell-starter/src/test/java/org/apache/camel/component/shell/springboot/ShellComponentAutoConfigurationTest.java @@ -0,0 +1,57 @@ +/* + * 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.component.shell.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.shell.ShellComponent; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, ShellComponentAutoConfiguration.class }, + properties = { + "camel.component.shell.show-banner = false", + "camel.component.shell.banner-resource = custom-banner.txt" }) +public class ShellComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + // autoStart=false: ShellComponent.doStart() opens a real system terminal, + // which must not happen in a headless test run. Property binding by the + // starter's ComponentCustomizer happens on component creation, before start. + ShellComponent component = assertInstanceOf(ShellComponent.class, context.getComponent("shell", true, false)); + + // set through camel.component.shell.*, so this asserts the Spring Boot + // properties are copied onto the component by the starter + assertFalse(component.isShowBanner()); + assertEquals("custom-banner.txt", component.getBannerResource()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index e16f8f8cd174..5d13ee06f99a 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -447,6 +447,7 @@ camel-seda-starter camel-servicenow-starter camel-servlet-starter + camel-shell-starter camel-shiro-starter camel-sjms-starter camel-sjms2-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index 07cada25b94e..ab207ed372d9 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -346,6 +346,7 @@ ** xref:starters/seda.adoc[SEDA] ** xref:starters/servicenow.adoc[ServiceNow] ** xref:starters/servlet.adoc[Servlet] +** xref:starters/shell.adoc[Shell] ** xref:starters/shiro.adoc[Shiro] ** xref:starters/sjms.adoc[Simple JMS] ** xref:starters/sjms2.adoc[Simple JMS2] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/shell.adoc b/docs/spring-boot/modules/ROOT/pages/starters/shell.adoc new file mode 100644 index 000000000000..3b7512d6acac --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/shell.adoc @@ -0,0 +1,36 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += Shell +:artifactid: camel-shell-starter + +Camel Shell component + +== What's inside + +* xref:{csb-camel-components}::shell-component.adoc[Shell component], URI syntax: `shell:prompt` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-shell-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 5 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.shell.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.shell.banner-resource | Classpath resource path to a custom banner text file | camel-shell-banner.txt | String +| camel.component.shell.bridge-error-handler | 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. | false | Boolean +| camel.component.shell.enabled | Whether to enable auto configuration of the shell component. This is enabled by default. | | Boolean +| camel.component.shell.show-banner | Whether to print the Camel banner on startup | true | Boolean +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 15400e0c0db6..8b258b0efc23 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -2092,6 +2092,11 @@ camel-servlet-starter ${project.version} + + org.apache.camel.springboot + camel-shell-starter + ${project.version} + org.apache.camel.springboot camel-shiro-starter From 38f9031272f98f59fcada118bf2f4bc0798722ae Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:39:20 +0200 Subject: [PATCH 4/9] Add camel-spiffe-starter camel-spiffe fetches and validates SPIFFE workload identity from the SPIFFE Workload API but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test verifying camel.component.spiffe.* Spring Boot properties are copied onto the component's nested SpiffeConfiguration. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../springboot/catalog/components/spiffe.json | 52 +++++ .../camel-spiffe-starter/pom.xml | 48 +++++ .../src/main/docs/spiffe.json | 84 ++++++++ .../SpiffeComponentAutoConfiguration.java | 74 +++++++ .../SpiffeComponentConfiguration.java | 164 ++++++++++++++ .../springboot/SpiffeComponentConverter.java | 54 +++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 18 ++ .../SpiffeComponentAutoConfigurationTest.java | 57 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/starters/spiffe.adoc | 40 ++++ .../camel-spring-boot-dependencies/pom.xml | 5 + 15 files changed, 813 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/spiffe.json create mode 100644 components-starter/camel-spiffe-starter/pom.xml create mode 100644 components-starter/camel-spiffe-starter/src/main/docs/spiffe.json create mode 100644 components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfiguration.java create mode 100644 components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConfiguration.java create mode 100644 components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConverter.java create mode 100644 components-starter/camel-spiffe-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-spiffe-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-spiffe-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-spiffe-starter/src/test/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/spiffe.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index a53f989d07b4..9dc0ea70e1c4 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -344,6 +344,7 @@ smtp smtps snmp solr +spiffe splunk-hec spring-ai-chat spring-ai-embeddings diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/spiffe.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/spiffe.json new file mode 100644 index 000000000000..d57e205672a6 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/spiffe.json @@ -0,0 +1,52 @@ +{ + "component": { + "kind": "component", + "name": "spiffe", + "title": "SPIFFE", + "description": "Fetch and validate SPIFFE workload identity (X.509-SVID and JWT-SVID) from the SPIFFE Workload API.", + "deprecated": false, + "firstVersion": "4.23.0", + "label": "security", + "javaType": "org.apache.camel.component.spiffe.SpiffeComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-spiffe-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "spiffe", + "extendsScheme": "", + "syntax": "spiffe:label", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "audience": { "index": 0, "kind": "property", "displayName": "Audience", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "The comma-separated audience(s) to request for a JWT-SVID (fetchJwtSvid) or to validate against (validateJwtSvid). Can be overridden per-message with the CamelSpiffeAudience header. Note that validateJwtSvid validates against a single audience, so when several comma-separated audiences are given only the first one is used for validation; fetchJwtSvid requests all of them." }, + "configuration": { "index": 1, "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.spiffe.SpiffeConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configuration." }, + "lazyStartProducer": { "index": 2, "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 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." }, + "operation": { "index": 3, "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.spiffe.SpiffeOperation", "enum": [ "fetchX509Svid", "fetchJwtSvid", "validateJwtSvid" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "fetchX509Svid", "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "The operation to perform on the SPIFFE Workload API." }, + "autowiredEnabled": { "index": 4, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." }, + "workloadApiClient": { "index": 5, "kind": "property", "displayName": "Workload Api Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "io.spiffe.workloadapi.WorkloadApiClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "An existing WorkloadApiClient to use. When set, the component does not create or close its own client and spiffeSocketPath is ignored." }, + "allowOperationHeader": { "index": 6, "kind": "property", "displayName": "Allow Operation Header", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "security": "insecure:dev", "defaultValue": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "Whether the CamelSpiffeOperation header may override the configured operation. Disabled by default: the operation decides whether this endpoint validates a token or mints one, so a message that can set it can turn a validator into an endpoint that hands out this workload's own JWT-SVID. Enable it only on routes whose input is trusted." }, + "spiffeSocketPath": { "index": 7, "kind": "property", "displayName": "Spiffe Socket Path", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "The address of the SPIFFE Workload API endpoint (for example {code unix:\/\/\/tmp\/agent.sock} or {code tcp:\/\/127.0.0.1:8082}). When not set, the SPIFFE_ENDPOINT_SOCKET environment variable is used." } + }, + "headers": { + "CamelSpiffeOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.spiffe.SpiffeOperation or String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Overrides the operation to be used by the producer. Ignored unless the endpoint sets allowOperationHeader=true, because the operation decides whether the endpoint validates a token or mints one.", "constantName": "org.apache.camel.component.spiffe.SpiffeConstants#OPERATION" }, + "CamelSpiffeAudience": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The comma-separated audience(s) for the fetchJwtSvid operation. Ignored by validateJwtSvid, which always validates against the configured audience: there the audience is the check that binds the token to this workload, not a parameter.", "constantName": "org.apache.camel.component.spiffe.SpiffeConstants#AUDIENCE" }, + "CamelSpiffeToken": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The JWT-SVID token to validate, for the validateJwtSvid operation.", "constantName": "org.apache.camel.component.spiffe.SpiffeConstants#TOKEN" }, + "CamelSpiffeSpiffeId": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The SPIFFE ID of the returned SVID.", "constantName": "org.apache.camel.component.spiffe.SpiffeConstants#SPIFFE_ID" }, + "CamelSpiffeExpiry": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "java.util.Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expiry of the returned JWT-SVID.", "constantName": "org.apache.camel.component.spiffe.SpiffeConstants#EXPIRY" } + }, + "properties": { + "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Logical name of the endpoint" }, + "audience": { "index": 1, "kind": "parameter", "displayName": "Audience", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "The comma-separated audience(s) to request for a JWT-SVID (fetchJwtSvid) or to validate against (validateJwtSvid). Can be overridden per-message with the CamelSpiffeAudience header. Note that validateJwtSvid validates against a single audience, so when several comma-separated audiences are given only the first one is used for validation; fetchJwtSvid requests all of them." }, + "operation": { "index": 2, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.spiffe.SpiffeOperation", "enum": [ "fetchX509Svid", "fetchJwtSvid", "validateJwtSvid" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "fetchX509Svid", "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "The operation to perform on the SPIFFE Workload API." }, + "lazyStartProducer": { "index": 3, "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 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." }, + "workloadApiClient": { "index": 4, "kind": "parameter", "displayName": "Workload Api Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "io.spiffe.workloadapi.WorkloadApiClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "An existing WorkloadApiClient to use. When set, the component does not create or close its own client and spiffeSocketPath is ignored." }, + "allowOperationHeader": { "index": 5, "kind": "parameter", "displayName": "Allow Operation Header", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "security": "insecure:dev", "defaultValue": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "Whether the CamelSpiffeOperation header may override the configured operation. Disabled by default: the operation decides whether this endpoint validates a token or mints one, so a message that can set it can turn a validator into an endpoint that hands out this workload's own JWT-SVID. Enable it only on routes whose input is trusted." }, + "spiffeSocketPath": { "index": 6, "kind": "parameter", "displayName": "Spiffe Socket Path", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.spiffe.SpiffeConfiguration", "configurationField": "configuration", "description": "The address of the SPIFFE Workload API endpoint (for example {code unix:\/\/\/tmp\/agent.sock} or {code tcp:\/\/127.0.0.1:8082}). When not set, the SPIFFE_ENDPOINT_SOCKET environment variable is used." } + } +} diff --git a/components-starter/camel-spiffe-starter/pom.xml b/components-starter/camel-spiffe-starter/pom.xml new file mode 100644 index 000000000000..e9f3da5096e7 --- /dev/null +++ b/components-starter/camel-spiffe-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-spiffe-starter + jar + Camel SB Starters :: spiffe + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-spiffe + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-spiffe-starter/src/main/docs/spiffe.json b/components-starter/camel-spiffe-starter/src/main/docs/spiffe.json new file mode 100644 index 000000000000..9333b219f3c9 --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/main/docs/spiffe.json @@ -0,0 +1,84 @@ +{ + "groups": [ + { + "name": "camel.component.spiffe", + "type": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration" + }, + { + "name": "camel.component.spiffe.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.spiffe.allow-operation-header", + "type": "java.lang.Boolean", + "description": "Whether the CamelSpiffeOperation header may override the configured operation. Disabled by default: the operation decides whether this endpoint validates a token or mints one, so a message that can set it can turn a validator into an endpoint that hands out this workload's own JWT-SVID. Enable it only on routes whose input is trusted.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.spiffe.audience", + "type": "java.lang.String", + "description": "The comma-separated audience(s) to request for a JWT-SVID (fetchJwtSvid) or to validate against (validateJwtSvid). Can be overridden per-message with the CamelSpiffeAudience header. Note that validateJwtSvid validates against a single audience, so when several comma-separated audiences are given only the first one is used for validation; fetchJwtSvid requests all of them.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration" + }, + { + "name": "camel.component.spiffe.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.spiffe.configuration", + "type": "org.apache.camel.component.spiffe.SpiffeConfiguration", + "description": "The component configuration. The option is a org.apache.camel.component.spiffe.SpiffeConfiguration type.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration" + }, + { + "name": "camel.component.spiffe.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.spiffe.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the spiffe component. This is enabled by default.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration" + }, + { + "name": "camel.component.spiffe.lazy-start-producer", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.spiffe.operation", + "type": "org.apache.camel.component.spiffe.SpiffeOperation", + "description": "The operation to perform on the SPIFFE Workload API.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration", + "defaultValue": "fetchx509svid" + }, + { + "name": "camel.component.spiffe.spiffe-socket-path", + "type": "java.lang.String", + "description": "The address of the SPIFFE Workload API endpoint (for example {code unix:\/\/\/tmp\/agent.sock} or {code tcp:\/\/127.0.0.1:8082}). When not set, the SPIFFE_ENDPOINT_SOCKET environment variable is used.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration" + }, + { + "name": "camel.component.spiffe.workload-api-client", + "type": "io.spiffe.workloadapi.WorkloadApiClient", + "description": "An existing WorkloadApiClient to use. When set, the component does not create or close its own client and spiffeSocketPath is ignored. The option is a io.spiffe.workloadapi.WorkloadApiClient type.", + "sourceType": "org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration" + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfiguration.java b/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfiguration.java new file mode 100644 index 000000000000..2ed9c5489ea5 --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.spiffe.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.spiffe.SpiffeComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = {CamelAutoConfiguration.class, SpiffeComponentConverter.class}) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,SpiffeComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.spiffe"}) +public class SpiffeComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final SpiffeComponentConfiguration configuration; + + public SpiffeComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.spiffe.springboot.SpiffeComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureSpiffeComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.spiffe", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.spiffe.customizer") + && target instanceof SpiffeComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConfiguration.java b/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConfiguration.java new file mode 100644 index 000000000000..d001de4c8ab1 --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConfiguration.java @@ -0,0 +1,164 @@ +/* + * 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.component.spiffe.springboot; + +import io.spiffe.workloadapi.WorkloadApiClient; +import org.apache.camel.component.spiffe.SpiffeComponent; +import org.apache.camel.component.spiffe.SpiffeConfiguration; +import org.apache.camel.component.spiffe.SpiffeOperation; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Fetch and validate SPIFFE workload identity (X.509-SVID and JWT-SVID) from + * the SPIFFE Workload API. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.spiffe") +public class SpiffeComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the spiffe component. This is + * enabled by default. + */ + private Boolean enabled; + /** + * The comma-separated audience(s) to request for a JWT-SVID (fetchJwtSvid) + * or to validate against (validateJwtSvid). Can be overridden per-message + * with the CamelSpiffeAudience header. Note that validateJwtSvid validates + * against a single audience, so when several comma-separated audiences are + * given only the first one is used for validation; fetchJwtSvid requests + * all of them. + */ + private String audience; + /** + * The component configuration. The option is a + * org.apache.camel.component.spiffe.SpiffeConfiguration type. + */ + private SpiffeConfiguration configuration; + /** + * 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. + */ + private Boolean lazyStartProducer = false; + /** + * The operation to perform on the SPIFFE Workload API. + */ + private SpiffeOperation operation = SpiffeOperation.fetchX509Svid; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + /** + * An existing WorkloadApiClient to use. When set, the component does not + * create or close its own client and spiffeSocketPath is ignored. The + * option is a io.spiffe.workloadapi.WorkloadApiClient type. + */ + private WorkloadApiClient workloadApiClient; + /** + * Whether the CamelSpiffeOperation header may override the configured + * operation. Disabled by default: the operation decides whether this + * endpoint validates a token or mints one, so a message that can set it can + * turn a validator into an endpoint that hands out this workload's own + * JWT-SVID. Enable it only on routes whose input is trusted. + */ + private Boolean allowOperationHeader = false; + /** + * The address of the SPIFFE Workload API endpoint (for example {code + * unix:///tmp/agent.sock} or {code tcp://127.0.0.1:8082}). When not set, + * the SPIFFE_ENDPOINT_SOCKET environment variable is used. + */ + private String spiffeSocketPath; + + public String getAudience() { + return audience; + } + + public void setAudience(String audience) { + this.audience = audience; + } + + public SpiffeConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(SpiffeConfiguration configuration) { + this.configuration = configuration; + } + + public Boolean getLazyStartProducer() { + return lazyStartProducer; + } + + public void setLazyStartProducer(Boolean lazyStartProducer) { + this.lazyStartProducer = lazyStartProducer; + } + + public SpiffeOperation getOperation() { + return operation; + } + + public void setOperation(SpiffeOperation operation) { + this.operation = operation; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } + + public WorkloadApiClient getWorkloadApiClient() { + return workloadApiClient; + } + + public void setWorkloadApiClient(WorkloadApiClient workloadApiClient) { + this.workloadApiClient = workloadApiClient; + } + + public Boolean getAllowOperationHeader() { + return allowOperationHeader; + } + + public void setAllowOperationHeader(Boolean allowOperationHeader) { + this.allowOperationHeader = allowOperationHeader; + } + + public String getSpiffeSocketPath() { + return spiffeSocketPath; + } + + public void setSpiffeSocketPath(String spiffeSocketPath) { + this.spiffeSocketPath = spiffeSocketPath; + } +} \ No newline at end of file diff --git a/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConverter.java b/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConverter.java new file mode 100644 index 000000000000..f60864094681 --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/main/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentConverter.java @@ -0,0 +1,54 @@ +/* + * 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.component.spiffe.springboot; + +import java.util.LinkedHashSet; +import java.util.Set; +import org.apache.camel.spring.boot.util.BeanReferenceHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.stereotype.Component; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@ConfigurationPropertiesBinding +@Component +public class SpiffeComponentConverter implements GenericConverter { + + @Autowired + private ApplicationContext applicationContext; + + public Set getConvertibleTypes() { + Set answer = new LinkedHashSet<>(); + answer.add(new ConvertiblePair(String.class, org.apache.camel.component.spiffe.SpiffeConfiguration.class)); + answer.add(new ConvertiblePair(String.class, io.spiffe.workloadapi.WorkloadApiClient.class)); + return answer; + } + + public Object convert( + Object source, + TypeDescriptor sourceType, + TypeDescriptor targetType) { + return BeanReferenceHelper.resolveBeanReference(applicationContext, source, targetType, "camel.component.spiffe"); + } +} \ No newline at end of file diff --git a/components-starter/camel-spiffe-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-spiffe-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-spiffe-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-spiffe-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-spiffe-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-spiffe-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..f77c41b70b4e --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.spiffe.springboot.SpiffeComponentConverter +org.apache.camel.component.spiffe.springboot.SpiffeComponentAutoConfiguration diff --git a/components-starter/camel-spiffe-starter/src/test/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfigurationTest.java b/components-starter/camel-spiffe-starter/src/test/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..f1c4472a1f9b --- /dev/null +++ b/components-starter/camel-spiffe-starter/src/test/java/org/apache/camel/component/spiffe/springboot/SpiffeComponentAutoConfigurationTest.java @@ -0,0 +1,57 @@ +/* + * 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.component.spiffe.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.spiffe.SpiffeComponent; +import org.apache.camel.component.spiffe.SpiffeOperation; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, SpiffeComponentAutoConfiguration.class }, + properties = { + "camel.component.spiffe.audience = demo-audience", + "camel.component.spiffe.operation = fetchJwtSvid", + "camel.component.spiffe.spiffe-socket-path = unix:///tmp/agent.sock" }) +public class SpiffeComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + SpiffeComponent component = assertInstanceOf(SpiffeComponent.class, context.getComponent("spiffe")); + + // set through camel.component.spiffe.*, so this asserts the Spring Boot + // properties are copied onto the component's nested SpiffeConfiguration by + // the starter + assertEquals("demo-audience", component.getConfiguration().getAudience()); + assertEquals(SpiffeOperation.fetchJwtSvid, component.getConfiguration().getOperation()); + assertEquals("unix:///tmp/agent.sock", component.getConfiguration().getSpiffeSocketPath()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index 5d13ee06f99a..cda3d1cd1536 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -459,6 +459,7 @@ camel-snmp-starter camel-soap-starter camel-solr-starter + camel-spiffe-starter camel-splunk-hec-starter camel-spring-ai-chat-starter camel-spring-ai-embeddings-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index ab207ed372d9..f96cde97a387 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -358,6 +358,7 @@ ** xref:starters/snmp.adoc[SNMP] ** xref:starters/soap.adoc[SOAP] ** xref:starters/solr.adoc[Solr] +** xref:starters/spiffe.adoc[SPIFFE] ** xref:starters/splunk-hec.adoc[Splunk HEC] ** xref:starters/spring-ai-chat.adoc[Spring AI Chat] ** xref:starters/spring-ai-embeddings.adoc[Spring AI Embeddings] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/spiffe.adoc b/docs/spring-boot/modules/ROOT/pages/starters/spiffe.adoc new file mode 100644 index 000000000000..698807a18da8 --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/spiffe.adoc @@ -0,0 +1,40 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += SPIFFE +:artifactid: camel-spiffe-starter + +Fetch and validate SPIFFE workload identity (X.509-SVID and JWT-SVID) from the SPIFFE Workload API. + +== What's inside + +* xref:{csb-camel-components}::spiffe-component.adoc[SPIFFE component], URI syntax: `spiffe:label` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-spiffe-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 9 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.spiffe.allow-operation-header | Whether the CamelSpiffeOperation header may override the configured operation. Disabled by default: the operation decides whether this endpoint validates a token or mints one, so a message that can set it can turn a validator into an endpoint that hands out this workload's own JWT-SVID. Enable it only on routes whose input is trusted. | false | Boolean +| camel.component.spiffe.audience | The comma-separated audience(s) to request for a JWT-SVID (fetchJwtSvid) or to validate against (validateJwtSvid). Can be overridden per-message with the CamelSpiffeAudience header. Note that validateJwtSvid validates against a single audience, so when several comma-separated audiences are given only the first one is used for validation; fetchJwtSvid requests all of them. | | String +| camel.component.spiffe.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.spiffe.configuration | The component configuration. The option is a org.apache.camel.component.spiffe.SpiffeConfiguration type. | | SpiffeConfiguration +| camel.component.spiffe.enabled | Whether to enable auto configuration of the spiffe component. This is enabled by default. | | Boolean +| camel.component.spiffe.lazy-start-producer | 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. | false | Boolean +| camel.component.spiffe.operation | The operation to perform on the SPIFFE Workload API. | fetchx509svid | SpiffeOperation +| camel.component.spiffe.spiffe-socket-path | The address of the SPIFFE Workload API endpoint (for example \{code unix:///tmp/agent.sock} or \{code tcp://127.0.0.1:8082}). When not set, the SPIFFE_ENDPOINT_SOCKET environment variable is used. | | String +| camel.component.spiffe.workload-api-client | An existing WorkloadApiClient to use. When set, the component does not create or close its own client and spiffeSocketPath is ignored. The option is a io.spiffe.workloadapi.WorkloadApiClient type. | | WorkloadApiClient +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 8b258b0efc23..7ea186b5d5d6 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -2152,6 +2152,11 @@ camel-solr-starter ${project.version} + + org.apache.camel.springboot + camel-spiffe-starter + ${project.version} + org.apache.camel.springboot camel-splunk-hec-starter From 2b22dbc02ba5dc04344b7d96e48df6794fc9b014 Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:40:04 +0200 Subject: [PATCH 5/9] Add camel-state-store-starter camel-state-store performs key-value operations against a pluggable KeyValueRepository backend but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test verifying camel.component.state-store.* Spring Boot properties are copied onto the StateStoreComponent bean. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../catalog/components/state-store.json | 42 ++++ .../camel-state-store-starter/pom.xml | 48 +++++ .../src/main/docs/state-store.json | 46 ++++ .../StateStoreComponentAutoConfiguration.java | 74 +++++++ .../StateStoreComponentConfiguration.java | 73 +++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 17 ++ ...teStoreComponentAutoConfigurationTest.java | 55 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/starters/state-store.adoc | 34 +++ .../camel-spring-boot-dependencies/pom.xml | 5 + 14 files changed, 611 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/state-store.json create mode 100644 components-starter/camel-state-store-starter/pom.xml create mode 100644 components-starter/camel-state-store-starter/src/main/docs/state-store.json create mode 100644 components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfiguration.java create mode 100644 components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentConfiguration.java create mode 100644 components-starter/camel-state-store-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-state-store-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-state-store-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-state-store-starter/src/test/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/state-store.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index 9dc0ea70e1c4..e2c864f336fe 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -360,6 +360,7 @@ spring-ws sql sql-stored ssh +state-store stax stitch stomp diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/state-store.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/state-store.json new file mode 100644 index 000000000000..f897b020ba7e --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/state-store.json @@ -0,0 +1,42 @@ +{ + "component": { + "kind": "component", + "name": "state-store", + "title": "State Store", + "description": "Perform key-value operations against a pluggable KeyValueRepository backend.", + "deprecated": false, + "firstVersion": "4.23.0", + "label": "cache", + "javaType": "org.apache.camel.component.statestore.StateStoreComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-state-store-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "state-store", + "extendsScheme": "", + "syntax": "state-store:storeName", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "lazyStartProducer": { "index": 0, "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 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." }, + "autowiredEnabled": { "index": 1, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } + }, + "headers": { + "CamelStateStoreOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.statestore.StateStoreOperations", "enum": [ "put", "putIfAbsent", "get", "delete", "contains", "keys", "size", "clear" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.camel.component.statestore.StateStoreConstants#OPERATION" }, + "CamelStateStoreKey": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The key to use for the operation", "constantName": "org.apache.camel.component.statestore.StateStoreConstants#KEY" }, + "CamelStateStoreTtl": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Per-message TTL override in milliseconds. Takes precedence over the endpoint ttl option.", "constantName": "org.apache.camel.component.statestore.StateStoreConstants#TTL" } + }, + "properties": { + "storeName": { "index": 0, "kind": "path", "displayName": "Store Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the state store" }, + "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.statestore.StateStoreOperations", "enum": [ "put", "putIfAbsent", "get", "delete", "contains", "keys", "size", "clear" ], "deprecated": false, "autowired": false, "secret": false, "description": "The default operation to perform" }, + "ttl": { "index": 2, "kind": "parameter", "displayName": "Ttl", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "description": "Time-to-live in milliseconds for entries. 0 means no expiry." }, + "lazyStartProducer": { "index": 3, "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 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." }, + "backend": { "index": 4, "kind": "parameter", "displayName": "Backend", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.KeyValueRepository", "deprecated": false, "autowired": false, "secret": false, "description": "The backend to use. If not set, auto-discovers a single KeyValueRepository from the registry, or falls back to an in-memory store." } + } +} diff --git a/components-starter/camel-state-store-starter/pom.xml b/components-starter/camel-state-store-starter/pom.xml new file mode 100644 index 000000000000..ca52dd1af8e9 --- /dev/null +++ b/components-starter/camel-state-store-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-state-store-starter + jar + Camel SB Starters :: state-store + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-state-store + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-state-store-starter/src/main/docs/state-store.json b/components-starter/camel-state-store-starter/src/main/docs/state-store.json new file mode 100644 index 000000000000..b0cca9694ca2 --- /dev/null +++ b/components-starter/camel-state-store-starter/src/main/docs/state-store.json @@ -0,0 +1,46 @@ +{ + "groups": [ + { + "name": "camel.component.state-store", + "type": "org.apache.camel.component.statestore.springboot.StateStoreComponentConfiguration", + "sourceType": "org.apache.camel.component.statestore.springboot.StateStoreComponentConfiguration" + }, + { + "name": "camel.component.state-store.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.statestore.springboot.StateStoreComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.state-store.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.statestore.springboot.StateStoreComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.state-store.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.state-store.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the state-store component. This is enabled by default.", + "sourceType": "org.apache.camel.component.statestore.springboot.StateStoreComponentConfiguration" + }, + { + "name": "camel.component.state-store.lazy-start-producer", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.statestore.springboot.StateStoreComponentConfiguration", + "defaultValue": false + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfiguration.java b/components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfiguration.java new file mode 100644 index 000000000000..18af489df369 --- /dev/null +++ b/components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.statestore.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.statestore.StateStoreComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = CamelAutoConfiguration.class) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,StateStoreComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.state-store"}) +public class StateStoreComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final StateStoreComponentConfiguration configuration; + + public StateStoreComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.statestore.springboot.StateStoreComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureStateStoreComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.state-store", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.state-store.customizer") + && target instanceof StateStoreComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentConfiguration.java b/components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentConfiguration.java new file mode 100644 index 000000000000..8a51f009a82b --- /dev/null +++ b/components-starter/camel-state-store-starter/src/main/java/org/apache/camel/component/statestore/springboot/StateStoreComponentConfiguration.java @@ -0,0 +1,73 @@ +/* + * 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.component.statestore.springboot; + +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Perform key-value operations against a pluggable KeyValueRepository backend. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.state-store") +public class StateStoreComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the state-store component. This + * is enabled by default. + */ + private Boolean enabled; + /** + * 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. + */ + private Boolean lazyStartProducer = false; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + + public Boolean getLazyStartProducer() { + return lazyStartProducer; + } + + public void setLazyStartProducer(Boolean lazyStartProducer) { + this.lazyStartProducer = lazyStartProducer; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } +} \ No newline at end of file diff --git a/components-starter/camel-state-store-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-state-store-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-state-store-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-state-store-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-state-store-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-state-store-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-state-store-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-state-store-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..99638692ce11 --- /dev/null +++ b/components-starter/camel-state-store-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,17 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.statestore.springboot.StateStoreComponentAutoConfiguration diff --git a/components-starter/camel-state-store-starter/src/test/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfigurationTest.java b/components-starter/camel-state-store-starter/src/test/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..c226327eb7b2 --- /dev/null +++ b/components-starter/camel-state-store-starter/src/test/java/org/apache/camel/component/statestore/springboot/StateStoreComponentAutoConfigurationTest.java @@ -0,0 +1,55 @@ +/* + * 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.component.statestore.springboot; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.statestore.StateStoreComponent; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, StateStoreComponentAutoConfiguration.class }, + properties = { + "camel.component.state-store.lazy-start-producer = true", + "camel.component.state-store.autowired-enabled = false" }) +public class StateStoreComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + StateStoreComponent component + = assertInstanceOf(StateStoreComponent.class, context.getComponent("state-store")); + + // set through camel.component.state-store.*, so this asserts the Spring Boot + // properties are copied onto the component by the starter + assertTrue(component.isLazyStartProducer()); + assertFalse(component.isAutowiredEnabled()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index cda3d1cd1536..3d17ba47aa0c 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -477,6 +477,7 @@ camel-springdoc-starter camel-sql-starter camel-ssh-starter + camel-state-store-starter camel-stax-starter camel-stitch-starter camel-stream-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index f96cde97a387..7840d3172db9 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -376,6 +376,7 @@ ** xref:starters/springdoc.adoc[Springdoc] ** xref:starters/sql.adoc[SQL] ** xref:starters/ssh.adoc[SSH] +** xref:starters/state-store.adoc[State Store] ** xref:starters/stax.adoc[StAX] ** xref:starters/stitch.adoc[Stitch] ** xref:starters/stream.adoc[Stream] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/state-store.adoc b/docs/spring-boot/modules/ROOT/pages/starters/state-store.adoc new file mode 100644 index 000000000000..7ea97aee1278 --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/state-store.adoc @@ -0,0 +1,34 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += State Store +:artifactid: camel-state-store-starter + +Perform key-value operations against a pluggable KeyValueRepository backend. + +== What's inside + +* xref:{csb-camel-components}::state-store-component.adoc[State Store component], URI syntax: `state-store:storeName` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-state-store-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 3 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.state-store.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.state-store.enabled | Whether to enable auto configuration of the state-store component. This is enabled by default. | | Boolean +| camel.component.state-store.lazy-start-producer | 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. | false | Boolean +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 7ea186b5d5d6..bcab2876dfb5 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -2262,6 +2262,11 @@ camel-ssh-starter ${project.version} + + org.apache.camel.springboot + camel-state-store-starter + ${project.version} + org.apache.camel.springboot camel-stax-starter From 87accc4f5667361f13251a307b1c5b056c1350ad Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:40:58 +0200 Subject: [PATCH 6/9] Add camel-ai-resource-starter camel-ai-resource registers Camel routes as read-only AI resources in the shared AiResourceRegistry but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test verifying camel.component.ai-resource.* Spring Boot properties are copied onto the component's nested AiResourceConfiguration. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../catalog/components/ai-resource.json | 47 ++++ .../camel-ai-resource-starter/pom.xml | 48 +++++ .../src/main/docs/ai-resource.json | 83 +++++++ .../AiResourceComponentAutoConfiguration.java | 74 +++++++ .../AiResourceComponentConfiguration.java | 162 ++++++++++++++ .../AiResourceComponentConverter.java | 53 +++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 18 ++ ...esourceComponentAutoConfigurationTest.java | 55 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/starters/ai-resource.adoc | 40 ++++ .../camel-spring-boot-dependencies/pom.xml | 5 + 15 files changed, 802 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ai-resource.json create mode 100644 components-starter/camel-ai-resource-starter/pom.xml create mode 100644 components-starter/camel-ai-resource-starter/src/main/docs/ai-resource.json create mode 100644 components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfiguration.java create mode 100644 components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConfiguration.java create mode 100644 components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConverter.java create mode 100644 components-starter/camel-ai-resource-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-ai-resource-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-ai-resource-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-ai-resource-starter/src/test/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/ai-resource.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index e2c864f336fe..23d447d7ccaf 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -1,6 +1,7 @@ a2a activemq activemq6 +ai-resource ai-tool alibaba-eventbridge alibaba-fc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ai-resource.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ai-resource.json new file mode 100644 index 000000000000..18004cc166c2 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ai-resource.json @@ -0,0 +1,47 @@ +{ + "component": { + "kind": "component", + "name": "ai-resource", + "title": "AI Resource", + "description": "Framework-agnostic consumer endpoint that registers a Camel route as a read-only AI resource in the shared AiResourceRegistry.", + "deprecated": false, + "firstVersion": "4.23.0", + "label": "ai", + "javaType": "org.apache.camel.component.ai.resource.AiResourceComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-ai-resource-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "ai-resource", + "extendsScheme": "", + "syntax": "ai-resource:resourceName", + "async": false, + "api": false, + "consumerOnly": true, + "producerOnly": false, + "lenientProperties": false, + "browsable": false, + "remote": false + }, + "componentProperties": { + "bridgeErrorHandler": { "index": 0, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "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 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." }, + "configuration": { "index": 1, "kind": "property", "displayName": "Configuration", "group": "consumer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configuration" }, + "description": { "index": 2, "kind": "property", "displayName": "Description", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "Human-readable description of what this resource contains. Passed verbatim to the client. When omitted, defaults to the resource name." }, + "mimeType": { "index": 3, "kind": "property", "displayName": "Mime Type", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "text\/plain", "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "MIME type of the content the route produces. Types denoting text, such as any text subtype, application\/json, and any subtype ending in json, xml or yaml, are read as a string. Every other type is read as raw bytes and delivered to clients as a binary blob." }, + "resourceUri": { "index": 4, "kind": "property", "displayName": "Resource Uri", "group": "consumer", "label": "consumer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "The resource uri clients use to read this resource, for example camel:\/\/\/config\/app.json or s3:\/\/reports\/latest.pdf. It must be unique within the CamelContext and is what an MCP client sends in a resources\/read request." }, + "tags": { "index": 5, "kind": "property", "displayName": "Tags", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "Comma-separated list of tags used to group resources. Adapters filter the registry by these tags to select which resources to expose. When omitted, the resource goes into a default pool which camel-mcp-server never exposes." }, + "title": { "index": 6, "kind": "property", "displayName": "Title", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "Optional display title for resource listings. Advisory hint for clients only." }, + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } + }, + "properties": { + "resourceName": { "index": 0, "kind": "path", "displayName": "Resource Name", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The resource name. This is the human-readable label clients see in resource listings." }, + "description": { "index": 1, "kind": "parameter", "displayName": "Description", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "Human-readable description of what this resource contains. Passed verbatim to the client. When omitted, defaults to the resource name." }, + "mimeType": { "index": 2, "kind": "parameter", "displayName": "Mime Type", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "text\/plain", "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "MIME type of the content the route produces. Types denoting text, such as any text subtype, application\/json, and any subtype ending in json, xml or yaml, are read as a string. Every other type is read as raw bytes and delivered to clients as a binary blob." }, + "resourceUri": { "index": 3, "kind": "parameter", "displayName": "Resource Uri", "group": "consumer", "label": "consumer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "The resource uri clients use to read this resource, for example camel:\/\/\/config\/app.json or s3:\/\/reports\/latest.pdf. It must be unique within the CamelContext and is what an MCP client sends in a resources\/read request." }, + "tags": { "index": 4, "kind": "parameter", "displayName": "Tags", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "Comma-separated list of tags used to group resources. Adapters filter the registry by these tags to select which resources to expose. When omitted, the resource goes into a default pool which camel-mcp-server never exposes." }, + "title": { "index": 5, "kind": "parameter", "displayName": "Title", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ai.resource.AiResourceConfiguration", "configurationField": "configuration", "description": "Optional display title for resource listings. Advisory hint for clients only." }, + "bridgeErrorHandler": { "index": 6, "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 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." }, + "exceptionHandler": { "index": 7, "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 default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, + "exchangePattern": { "index": 8, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." } + } +} diff --git a/components-starter/camel-ai-resource-starter/pom.xml b/components-starter/camel-ai-resource-starter/pom.xml new file mode 100644 index 000000000000..815392e1bf58 --- /dev/null +++ b/components-starter/camel-ai-resource-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-ai-resource-starter + jar + Camel SB Starters :: ai-resource + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-ai-resource + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-ai-resource-starter/src/main/docs/ai-resource.json b/components-starter/camel-ai-resource-starter/src/main/docs/ai-resource.json new file mode 100644 index 000000000000..67d44f4fd609 --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/main/docs/ai-resource.json @@ -0,0 +1,83 @@ +{ + "groups": [ + { + "name": "camel.component.ai-resource", + "type": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration" + }, + { + "name": "camel.component.ai-resource.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.ai-resource.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.ai-resource.bridge-error-handler", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.ai-resource.configuration", + "type": "org.apache.camel.component.ai.resource.AiResourceConfiguration", + "description": "The component configuration. The option is a org.apache.camel.component.ai.resource.AiResourceConfiguration type.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration" + }, + { + "name": "camel.component.ai-resource.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.ai-resource.description", + "type": "java.lang.String", + "description": "Human-readable description of what this resource contains. Passed verbatim to the client. When omitted, defaults to the resource name.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration" + }, + { + "name": "camel.component.ai-resource.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the ai-resource component. This is enabled by default.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration" + }, + { + "name": "camel.component.ai-resource.mime-type", + "type": "java.lang.String", + "description": "MIME type of the content the route produces. Types denoting text, such as any text subtype, application\/json, and any subtype ending in json, xml or yaml, are read as a string. Every other type is read as raw bytes and delivered to clients as a binary blob.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration", + "defaultValue": "text\/plain" + }, + { + "name": "camel.component.ai-resource.resource-uri", + "type": "java.lang.String", + "description": "The resource uri clients use to read this resource, for example camel:\/\/\/config\/app.json or s3:\/\/reports\/latest.pdf. It must be unique within the CamelContext and is what an MCP client sends in a resources\/read request.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration" + }, + { + "name": "camel.component.ai-resource.tags", + "type": "java.lang.String", + "description": "Comma-separated list of tags used to group resources. Adapters filter the registry by these tags to select which resources to expose. When omitted, the resource goes into a default pool which camel-mcp-server never exposes.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration" + }, + { + "name": "camel.component.ai-resource.title", + "type": "java.lang.String", + "description": "Optional display title for resource listings. Advisory hint for clients only.", + "sourceType": "org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration" + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfiguration.java b/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfiguration.java new file mode 100644 index 000000000000..00d5fc76e000 --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.ai.resource.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.ai.resource.AiResourceComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = {CamelAutoConfiguration.class, AiResourceComponentConverter.class}) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,AiResourceComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.ai-resource"}) +public class AiResourceComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final AiResourceComponentConfiguration configuration; + + public AiResourceComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.ai.resource.springboot.AiResourceComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureAiResourceComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.ai-resource", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.ai-resource.customizer") + && target instanceof AiResourceComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConfiguration.java b/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConfiguration.java new file mode 100644 index 000000000000..2de10e9e341e --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConfiguration.java @@ -0,0 +1,162 @@ +/* + * 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.component.ai.resource.springboot; + +import org.apache.camel.component.ai.resource.AiResourceConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Framework-agnostic consumer endpoint that registers a Camel route as a + * read-only AI resource in the shared AiResourceRegistry. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.ai-resource") +public class AiResourceComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the ai-resource component. This + * is enabled by default. + */ + private Boolean enabled; + /** + * 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. + */ + private Boolean bridgeErrorHandler = false; + /** + * The component configuration. The option is a + * org.apache.camel.component.ai.resource.AiResourceConfiguration type. + */ + private AiResourceConfiguration configuration; + /** + * Human-readable description of what this resource contains. Passed + * verbatim to the client. When omitted, defaults to the resource name. + */ + private String description; + /** + * MIME type of the content the route produces. Types denoting text, such as + * any text subtype, application/json, and any subtype ending in json, xml + * or yaml, are read as a string. Every other type is read as raw bytes and + * delivered to clients as a binary blob. + */ + private String mimeType = "text/plain"; + /** + * The resource uri clients use to read this resource, for example + * camel:///config/app.json or s3://reports/latest.pdf. It must be unique + * within the CamelContext and is what an MCP client sends in a + * resources/read request. + */ + private String resourceUri; + /** + * Comma-separated list of tags used to group resources. Adapters filter the + * registry by these tags to select which resources to expose. When omitted, + * the resource goes into a default pool which camel-mcp-server never + * exposes. + */ + private String tags; + /** + * Optional display title for resource listings. Advisory hint for clients + * only. + */ + private String title; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + + public Boolean getBridgeErrorHandler() { + return bridgeErrorHandler; + } + + public void setBridgeErrorHandler(Boolean bridgeErrorHandler) { + this.bridgeErrorHandler = bridgeErrorHandler; + } + + public AiResourceConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(AiResourceConfiguration configuration) { + this.configuration = configuration; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + public String getResourceUri() { + return resourceUri; + } + + public void setResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + } + + public String getTags() { + return tags; + } + + public void setTags(String tags) { + this.tags = tags; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } +} \ No newline at end of file diff --git a/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConverter.java b/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConverter.java new file mode 100644 index 000000000000..37dbdd79d85f --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/main/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentConverter.java @@ -0,0 +1,53 @@ +/* + * 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.component.ai.resource.springboot; + +import java.util.LinkedHashSet; +import java.util.Set; +import org.apache.camel.spring.boot.util.BeanReferenceHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.stereotype.Component; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@ConfigurationPropertiesBinding +@Component +public class AiResourceComponentConverter implements GenericConverter { + + @Autowired + private ApplicationContext applicationContext; + + public Set getConvertibleTypes() { + Set answer = new LinkedHashSet<>(); + answer.add(new ConvertiblePair(String.class, org.apache.camel.component.ai.resource.AiResourceConfiguration.class)); + return answer; + } + + public Object convert( + Object source, + TypeDescriptor sourceType, + TypeDescriptor targetType) { + return BeanReferenceHelper.resolveBeanReference(applicationContext, source, targetType, "camel.component.ai-resource"); + } +} \ No newline at end of file diff --git a/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..eb8cc6f39f61 --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.ai.resource.springboot.AiResourceComponentConverter +org.apache.camel.component.ai.resource.springboot.AiResourceComponentAutoConfiguration diff --git a/components-starter/camel-ai-resource-starter/src/test/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfigurationTest.java b/components-starter/camel-ai-resource-starter/src/test/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..9f59814cf3ad --- /dev/null +++ b/components-starter/camel-ai-resource-starter/src/test/java/org/apache/camel/component/ai/resource/springboot/AiResourceComponentAutoConfigurationTest.java @@ -0,0 +1,55 @@ +/* + * 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.component.ai.resource.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.ai.resource.AiResourceComponent; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, AiResourceComponentAutoConfiguration.class }, + properties = { + "camel.component.ai-resource.mime-type = application/json", + "camel.component.ai-resource.tags = demo" }) +public class AiResourceComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + AiResourceComponent component + = assertInstanceOf(AiResourceComponent.class, context.getComponent("ai-resource")); + + // set through camel.component.ai-resource.*, so this asserts the Spring Boot + // properties are copied onto the component's nested AiResourceConfiguration by + // the starter + assertEquals("application/json", component.getConfiguration().getMimeType()); + assertEquals("demo", component.getConfiguration().getTags()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index 3d17ba47aa0c..3d39d7cf0ea0 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -109,6 +109,7 @@ camel-activemq-starter camel-activemq6-starter camel-ai-observability-starter + camel-ai-resource-starter camel-ai-tool-starter camel-alibaba-eventbridge-starter camel-alibaba-fc-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index 7840d3172db9..46212af7f9d5 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -8,6 +8,7 @@ ** xref:starters/activemq.adoc[ActiveMQ 5.x] ** xref:starters/activemq6.adoc[ActiveMQ 6.x] ** xref:starters/ai-observability.adoc[Ai Observability] +** xref:starters/ai-resource.adoc[AI Resource] ** xref:starters/ai-tool.adoc[AI Tool] ** xref:starters/alibaba-eventbridge.adoc[Alibaba EventBridge] ** xref:starters/alibaba-fc.adoc[Alibaba Function Compute (FC)] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/ai-resource.adoc b/docs/spring-boot/modules/ROOT/pages/starters/ai-resource.adoc new file mode 100644 index 000000000000..1928c4f1b0bf --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/ai-resource.adoc @@ -0,0 +1,40 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += AI Resource +:artifactid: camel-ai-resource-starter + +Framework-agnostic consumer endpoint that registers a Camel route as a read-only AI resource in the shared AiResourceRegistry. + +== What's inside + +* xref:{csb-camel-components}::ai-resource-component.adoc[AI Resource component], URI syntax: `ai-resource:resourceName` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-ai-resource-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 9 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.ai-resource.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.ai-resource.bridge-error-handler | 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. | false | Boolean +| camel.component.ai-resource.configuration | The component configuration. The option is a org.apache.camel.component.ai.resource.AiResourceConfiguration type. | | AiResourceConfiguration +| camel.component.ai-resource.description | Human-readable description of what this resource contains. Passed verbatim to the client. When omitted, defaults to the resource name. | | String +| camel.component.ai-resource.enabled | Whether to enable auto configuration of the ai-resource component. This is enabled by default. | | Boolean +| camel.component.ai-resource.mime-type | MIME type of the content the route produces. Types denoting text, such as any text subtype, application/json, and any subtype ending in json, xml or yaml, are read as a string. Every other type is read as raw bytes and delivered to clients as a binary blob. | text/plain | String +| camel.component.ai-resource.resource-uri | The resource uri clients use to read this resource, for example camel:///config/app.json or s3://reports/latest.pdf. It must be unique within the CamelContext and is what an MCP client sends in a resources/read request. | | String +| camel.component.ai-resource.tags | Comma-separated list of tags used to group resources. Adapters filter the registry by these tags to select which resources to expose. When omitted, the resource goes into a default pool which camel-mcp-server never exposes. | | String +| camel.component.ai-resource.title | Optional display title for resource listings. Advisory hint for clients only. | | String +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index bcab2876dfb5..fa6142e09e03 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -372,6 +372,11 @@ camel-ai-observability-starter ${project.version} + + org.apache.camel.springboot + camel-ai-resource-starter + ${project.version} + org.apache.camel.springboot camel-ai-tool-starter From d1855265886cebc56f08ca155ecd170fd8ebe5b1 Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:42:20 +0200 Subject: [PATCH 7/9] Add camel-pgvector-starter camel-pgvector performs vector operations against the PostgreSQL pgvector extension but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog (including the pgvector-embeddings/pgvector-rag data type transformers) and dependencies BOM entries. Add a smoke test verifying camel.component.pgvector.* Spring Boot properties are copied onto the component's nested PgVectorConfiguration. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../catalog/components/pgvector.json | 50 +++++ .../catalog/transformers.properties | 2 + .../transformers/pgvector-embeddings.json | 14 ++ .../catalog/transformers/pgvector-rag.json | 14 ++ .../camel-pgvector-starter/pom.xml | 48 +++++ .../src/main/docs/pgvector.json | 66 ++++++ .../PgVectorComponentAutoConfiguration.java | 74 +++++++ .../PgVectorComponentConfiguration.java | 127 +++++++++++ .../PgVectorComponentConverter.java | 54 +++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 18 ++ ...gVectorComponentAutoConfigurationTest.java | 55 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/starters/pgvector.adoc | 37 ++++ .../camel-spring-boot-dependencies/pom.xml | 5 + 18 files changed, 781 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pgvector.json create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-embeddings.json create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-rag.json create mode 100644 components-starter/camel-pgvector-starter/pom.xml create mode 100644 components-starter/camel-pgvector-starter/src/main/docs/pgvector.json create mode 100644 components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfiguration.java create mode 100644 components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConfiguration.java create mode 100644 components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConverter.java create mode 100644 components-starter/camel-pgvector-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-pgvector-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-pgvector-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-pgvector-starter/src/test/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/pgvector.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index 23d447d7ccaf..daaa1e4740c7 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -303,6 +303,7 @@ paho-mqtt5 pdf pg-replication-slot pgevent +pgvector pinecone platform-http plc4x diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pgvector.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pgvector.json new file mode 100644 index 000000000000..39940f894ecb --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pgvector.json @@ -0,0 +1,50 @@ +{ + "component": { + "kind": "component", + "name": "pgvector", + "title": "PGVector", + "description": "Perform operations on the PostgreSQL pgvector Vector Database.", + "deprecated": false, + "firstVersion": "4.19.0", + "label": "database,ai", + "javaType": "org.apache.camel.component.pgvector.PgVectorComponent", + "supportLevel": "Stable", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-pgvector-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "pgvector", + "extendsScheme": "", + "syntax": "pgvector:collection", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "configuration": { "index": 0, "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.pgvector.PgVectorConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The configuration;" }, + "dataSource": { "index": 1, "kind": "property", "displayName": "Data Source", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "javax.sql.DataSource", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.pgvector.PgVectorConfiguration", "configurationField": "configuration", "description": "The DataSource to use for connecting to the PostgreSQL database with pgvector extension." }, + "dimension": { "index": 2, "kind": "property", "displayName": "Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": 384, "configurationClass": "org.apache.camel.component.pgvector.PgVectorConfiguration", "configurationField": "configuration", "description": "The dimension of the vectors to store." }, + "distanceType": { "index": 3, "kind": "property", "displayName": "Distance Type", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.pgvector.PgVectorDistanceType", "enum": [ "COSINE", "EUCLIDEAN", "INNER_PRODUCT" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "COSINE", "configurationClass": "org.apache.camel.component.pgvector.PgVectorConfiguration", "configurationField": "configuration", "description": "The distance type to use for similarity search." }, + "lazyStartProducer": { "index": 4, "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 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." }, + "autowiredEnabled": { "index": 5, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } + }, + "headers": { + "CamelPgVectorAction": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "enum": [ "CREATE_TABLE", "CREATE_INDEX", "DROP_TABLE", "UPSERT", "DELETE", "SIMILARITY_SEARCH" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The action to be performed.", "constantName": "org.apache.camel.component.pgvector.PgVectorHeaders#ACTION" }, + "CamelPgVectorRecordId": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The id of the vector record.", "constantName": "org.apache.camel.component.pgvector.PgVectorHeaders#RECORD_ID" }, + "CamelPgVectorQueryTopK": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "3", "description": "The maximum number of results to return for similarity search.", "constantName": "org.apache.camel.component.pgvector.PgVectorHeaders#QUERY_TOP_K" }, + "CamelPgVectorTextContent": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The text content to store alongside the vector embedding.", "constantName": "org.apache.camel.component.pgvector.PgVectorHeaders#TEXT_CONTENT" }, + "CamelPgVectorMetadata": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The metadata associated with the vector record, stored as JSON.", "constantName": "org.apache.camel.component.pgvector.PgVectorHeaders#METADATA" }, + "CamelPgVectorFilter": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Filter condition for similarity search. Applied as a SQL WHERE clause on the text_content and metadata columns. Supports parameterized queries using placeholders with values provided via the CamelPgVectorFilterParams header. WARNING: When not using parameterized queries, the filter value is appended directly as SQL. Never use untrusted input as the filter value without parameterization, as this could lead to SQL injection.", "constantName": "org.apache.camel.component.pgvector.PgVectorHeaders#FILTER" }, + "CamelPgVectorFilterParams": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.util.List", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Parameter values for parameterized filter queries. Use with placeholders in the CamelPgVectorFilter header. Example: filter = 'text_content LIKE AND metadata::jsonb-'category' = ' with filterParams = List.of(%hello%, science).", "constantName": "org.apache.camel.component.pgvector.PgVectorHeaders#FILTER_PARAMS" } + }, + "properties": { + "collection": { "index": 0, "kind": "path", "displayName": "Collection", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The collection (table) name" }, + "dataSource": { "index": 1, "kind": "parameter", "displayName": "Data Source", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "javax.sql.DataSource", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.pgvector.PgVectorConfiguration", "configurationField": "configuration", "description": "The DataSource to use for connecting to the PostgreSQL database with pgvector extension." }, + "dimension": { "index": 2, "kind": "parameter", "displayName": "Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": 384, "configurationClass": "org.apache.camel.component.pgvector.PgVectorConfiguration", "configurationField": "configuration", "description": "The dimension of the vectors to store." }, + "distanceType": { "index": 3, "kind": "parameter", "displayName": "Distance Type", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.pgvector.PgVectorDistanceType", "enum": [ "COSINE", "EUCLIDEAN", "INNER_PRODUCT" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "COSINE", "configurationClass": "org.apache.camel.component.pgvector.PgVectorConfiguration", "configurationField": "configuration", "description": "The distance type to use for similarity search." }, + "lazyStartProducer": { "index": 4, "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 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." } + } +} diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers.properties index 8bc37a131c9a..2e1fc59dfc0e 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers.properties @@ -32,6 +32,8 @@ infinispan-embeddings milvus-embeddings neo4j-embeddings neo4j-rag +pgvector-embeddings +pgvector-rag pinecone-embeddings pinecone-rag protobuf-binary diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-embeddings.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-embeddings.json new file mode 100644 index 000000000000..49a9f455a589 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-embeddings.json @@ -0,0 +1,14 @@ +{ + "transformer": { + "kind": "transformer", + "name": "pgvector:embeddings", + "title": "Pgvector (Embeddings)", + "description": "Prepares the message to become an object writable by PgVector component", + "deprecated": false, + "javaType": "org.apache.camel.component.pgvector.transform.PgVectorEmbeddingsDataTypeTransformer", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-pgvector-starter", + "version": "4.23.0-SNAPSHOT" + } +} + diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-rag.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-rag.json new file mode 100644 index 000000000000..5c3bb45f803a --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/transformers/pgvector-rag.json @@ -0,0 +1,14 @@ +{ + "transformer": { + "kind": "transformer", + "name": "pgvector:rag", + "title": "Pgvector (Rag)", + "description": "Prepares the PgVector similarity search results to become a List of String for LangChain4j RAG", + "deprecated": false, + "javaType": "org.apache.camel.component.pgvector.transform.PgVectorReverseEmbeddingsDataTypeTransformer", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-pgvector-starter", + "version": "4.23.0-SNAPSHOT" + } +} + diff --git a/components-starter/camel-pgvector-starter/pom.xml b/components-starter/camel-pgvector-starter/pom.xml new file mode 100644 index 000000000000..6bbfe1f4edef --- /dev/null +++ b/components-starter/camel-pgvector-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-pgvector-starter + jar + Camel SB Starters :: pgvector + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-pgvector + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-pgvector-starter/src/main/docs/pgvector.json b/components-starter/camel-pgvector-starter/src/main/docs/pgvector.json new file mode 100644 index 000000000000..f3d5875f15bb --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/main/docs/pgvector.json @@ -0,0 +1,66 @@ +{ + "groups": [ + { + "name": "camel.component.pgvector", + "type": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration" + }, + { + "name": "camel.component.pgvector.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.pgvector.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.pgvector.configuration", + "type": "org.apache.camel.component.pgvector.PgVectorConfiguration", + "description": "The configuration;. The option is a org.apache.camel.component.pgvector.PgVectorConfiguration type.", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration" + }, + { + "name": "camel.component.pgvector.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.pgvector.dimension", + "type": "java.lang.Integer", + "description": "The dimension of the vectors to store.", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration", + "defaultValue": 384 + }, + { + "name": "camel.component.pgvector.distance-type", + "type": "org.apache.camel.component.pgvector.PgVectorDistanceType", + "description": "The distance type to use for similarity search.", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration", + "defaultValue": "cosine" + }, + { + "name": "camel.component.pgvector.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the pgvector component. This is enabled by default.", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration" + }, + { + "name": "camel.component.pgvector.lazy-start-producer", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration", + "defaultValue": false + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfiguration.java b/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfiguration.java new file mode 100644 index 000000000000..d020a85d87bc --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.pgvector.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.pgvector.PgVectorComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = {CamelAutoConfiguration.class, PgVectorComponentConverter.class}) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,PgVectorComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.pgvector"}) +public class PgVectorComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final PgVectorComponentConfiguration configuration; + + public PgVectorComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.pgvector.springboot.PgVectorComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configurePgVectorComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.pgvector", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.pgvector.customizer") + && target instanceof PgVectorComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConfiguration.java b/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConfiguration.java new file mode 100644 index 000000000000..dfaa2107a1ae --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConfiguration.java @@ -0,0 +1,127 @@ +/* + * 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.component.pgvector.springboot; + +import javax.sql.DataSource; +import org.apache.camel.component.pgvector.PgVectorComponent; +import org.apache.camel.component.pgvector.PgVectorConfiguration; +import org.apache.camel.component.pgvector.PgVectorDistanceType; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Perform operations on the PostgreSQL pgvector Vector Database. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.pgvector") +public class PgVectorComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the pgvector component. This is + * enabled by default. + */ + private Boolean enabled; + /** + * The configuration;. The option is a + * org.apache.camel.component.pgvector.PgVectorConfiguration type. + */ + private PgVectorConfiguration configuration; + /** + * The DataSource to use for connecting to the PostgreSQL database with + * pgvector extension. The option is a javax.sql.DataSource type. + */ + private DataSource dataSource; + /** + * The dimension of the vectors to store. + */ + private Integer dimension = 384; + /** + * The distance type to use for similarity search. + */ + private PgVectorDistanceType distanceType = PgVectorDistanceType.COSINE; + /** + * 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. + */ + private Boolean lazyStartProducer = false; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + + public PgVectorConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(PgVectorConfiguration configuration) { + this.configuration = configuration; + } + + public DataSource getDataSource() { + return dataSource; + } + + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } + + public Integer getDimension() { + return dimension; + } + + public void setDimension(Integer dimension) { + this.dimension = dimension; + } + + public PgVectorDistanceType getDistanceType() { + return distanceType; + } + + public void setDistanceType(PgVectorDistanceType distanceType) { + this.distanceType = distanceType; + } + + public Boolean getLazyStartProducer() { + return lazyStartProducer; + } + + public void setLazyStartProducer(Boolean lazyStartProducer) { + this.lazyStartProducer = lazyStartProducer; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } +} \ No newline at end of file diff --git a/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConverter.java b/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConverter.java new file mode 100644 index 000000000000..ec0e7eda036a --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/main/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentConverter.java @@ -0,0 +1,54 @@ +/* + * 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.component.pgvector.springboot; + +import java.util.LinkedHashSet; +import java.util.Set; +import org.apache.camel.spring.boot.util.BeanReferenceHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.stereotype.Component; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@ConfigurationPropertiesBinding +@Component +public class PgVectorComponentConverter implements GenericConverter { + + @Autowired + private ApplicationContext applicationContext; + + public Set getConvertibleTypes() { + Set answer = new LinkedHashSet<>(); + answer.add(new ConvertiblePair(String.class, org.apache.camel.component.pgvector.PgVectorConfiguration.class)); + answer.add(new ConvertiblePair(String.class, javax.sql.DataSource.class)); + return answer; + } + + public Object convert( + Object source, + TypeDescriptor sourceType, + TypeDescriptor targetType) { + return BeanReferenceHelper.resolveBeanReference(applicationContext, source, targetType, "camel.component.pgvector"); + } +} \ No newline at end of file diff --git a/components-starter/camel-pgvector-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-pgvector-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-pgvector-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-pgvector-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-pgvector-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-pgvector-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..44ba332d98d9 --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.pgvector.springboot.PgVectorComponentConverter +org.apache.camel.component.pgvector.springboot.PgVectorComponentAutoConfiguration diff --git a/components-starter/camel-pgvector-starter/src/test/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfigurationTest.java b/components-starter/camel-pgvector-starter/src/test/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..484ea5cbf356 --- /dev/null +++ b/components-starter/camel-pgvector-starter/src/test/java/org/apache/camel/component/pgvector/springboot/PgVectorComponentAutoConfigurationTest.java @@ -0,0 +1,55 @@ +/* + * 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.component.pgvector.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.pgvector.PgVectorComponent; +import org.apache.camel.component.pgvector.PgVectorDistanceType; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, PgVectorComponentAutoConfiguration.class }, + properties = { + "camel.component.pgvector.dimension = 1536", + "camel.component.pgvector.distance-type = EUCLIDEAN" }) +public class PgVectorComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + PgVectorComponent component = assertInstanceOf(PgVectorComponent.class, context.getComponent("pgvector")); + + // set through camel.component.pgvector.*, so this asserts the Spring Boot + // properties are copied onto the component's nested PgVectorConfiguration by + // the starter + assertEquals(1536, component.getConfiguration().getDimension()); + assertEquals(PgVectorDistanceType.EUCLIDEAN, component.getConfiguration().getDistanceType()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index 3d39d7cf0ea0..6305e67bb887 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -413,6 +413,7 @@ camel-pdf-starter camel-pg-replication-slot-starter camel-pgevent-starter + camel-pgvector-starter camel-pinecone-starter camel-platform-http-starter camel-plc4x-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index 46212af7f9d5..c26db1ac94c6 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -312,6 +312,7 @@ ** xref:starters/pdf.adoc[PDF] ** xref:starters/pg-replication-slot.adoc[PostgreSQL Replication Slot] ** xref:starters/pgevent.adoc[PostgreSQL Event] +** xref:starters/pgvector.adoc[PGVector] ** xref:starters/pinecone.adoc[Pinecone] ** xref:starters/platform-http.adoc[Platform HTTP] ** xref:starters/plc4x.adoc[PLC4X] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/pgvector.adoc b/docs/spring-boot/modules/ROOT/pages/starters/pgvector.adoc new file mode 100644 index 000000000000..90b960740d34 --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/pgvector.adoc @@ -0,0 +1,37 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += PGVector +:artifactid: camel-pgvector-starter + +Perform operations on the PostgreSQL pgvector Vector Database. + +== What's inside + +* xref:{csb-camel-components}::pgvector-component.adoc[PGVector component], URI syntax: `pgvector:collection` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-pgvector-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 6 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.pgvector.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.pgvector.configuration | The configuration;. The option is a org.apache.camel.component.pgvector.PgVectorConfiguration type. | | PgVectorConfiguration +| camel.component.pgvector.dimension | The dimension of the vectors to store. | 384 | Integer +| camel.component.pgvector.distance-type | The distance type to use for similarity search. | cosine | PgVectorDistanceType +| camel.component.pgvector.enabled | Whether to enable auto configuration of the pgvector component. This is enabled by default. | | Boolean +| camel.component.pgvector.lazy-start-producer | 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. | false | Boolean +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index fa6142e09e03..3fe3b30623ec 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -1922,6 +1922,11 @@ camel-pgevent-starter ${project.version} + + org.apache.camel.springboot + camel-pgvector-starter + ${project.version} + org.apache.camel.springboot camel-pinecone-starter From c3546ff6cc8338d1048d88e2dad4ea2cdb61d019 Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:43:14 +0200 Subject: [PATCH 8/9] Add camel-langchain4j-ingest-starter camel-langchain4j-ingest splits, embeds and stores documents into a LangChain4j EmbeddingStore but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test verifying camel.component.langchain4j-ingest.* Spring Boot properties are copied onto the component's nested LangChain4jIngestConfiguration. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../components/langchain4j-ingest.json | 56 ++++ .../camel-langchain4j-ingest-starter/pom.xml | 48 ++++ .../src/main/docs/langchain4j-ingest.json | 111 ++++++++ ...ain4jIngestComponentAutoConfiguration.java | 74 ++++++ ...ngChain4jIngestComponentConfiguration.java | 244 ++++++++++++++++++ .../LangChain4jIngestComponentConverter.java | 57 ++++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 18 ++ ...jIngestComponentAutoConfigurationTest.java | 57 ++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../pages/starters/langchain4j-ingest.adoc | 44 ++++ .../camel-spring-boot-dependencies/pom.xml | 5 + 15 files changed, 931 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/langchain4j-ingest.json create mode 100644 components-starter/camel-langchain4j-ingest-starter/pom.xml create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/main/docs/langchain4j-ingest.json create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfiguration.java create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConfiguration.java create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConverter.java create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-langchain4j-ingest-starter/src/test/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/langchain4j-ingest.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index daaa1e4740c7..003c235048d6 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -249,6 +249,7 @@ langchain4j-agent langchain4j-chat langchain4j-embeddings langchain4j-embeddingstore +langchain4j-ingest langchain4j-web-search language ldap diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/langchain4j-ingest.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/langchain4j-ingest.json new file mode 100644 index 000000000000..3c1a08992525 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/langchain4j-ingest.json @@ -0,0 +1,56 @@ +{ + "component": { + "kind": "component", + "name": "langchain4j-ingest", + "title": "LangChain4j Ingest", + "description": "Ingest documents into a LangChain4j EmbeddingStore: split, embed and store the message body.", + "deprecated": false, + "firstVersion": "4.23.0", + "label": "ai", + "javaType": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-langchain4j-ingest-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "langchain4j-ingest", + "extendsScheme": "", + "syntax": "langchain4j-ingest:pipelineName", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "configuration": { "index": 0, "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The configuration." }, + "documentIdHeader": { "index": 1, "kind": "property", "displayName": "Document Id Header", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "CamelLangChain4jIngestDocumentId", "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "Name of the header carrying the document id, such as CamelAwsS3Key for an S3 consumer or CamelKafkaKey for a Kafka one. The CamelLangChain4jIngestDocumentId exchange property, when set, takes precedence - a route that parses documents captures the id into that property before the parse, so a document cannot forge its own identity. An exchange without an id fails." }, + "embeddingBatchSize": { "index": 2, "kind": "property", "displayName": "Embedding Batch Size", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 32, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "How many segments are embedded per request to the embedding model. Providers with generous per-request limits ingest large documents faster with a bigger batch; a batch carries at most embeddingBatchSize x maxSegmentSize characters, so tune the two together against the provider's token limits." }, + "embeddingModel": { "index": 3, "kind": "property", "displayName": "Embedding Model", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "dev.langchain4j.model.embedding.EmbeddingModel", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The EmbeddingModel to embed segments with. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option." }, + "embeddingStore": { "index": 4, "kind": "property", "displayName": "Embedding Store", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "dev.langchain4j.store.embedding.EmbeddingStore", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The EmbeddingStore to write segments to. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option." }, + "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 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." }, + "maxOverlapSize": { "index": 6, "kind": "property", "displayName": "Max Overlap Size", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 50, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "How much of the previous segment each segment repeats, in characters. Overlap keeps a sentence split across a boundary retrievable from either side." }, + "maxSegmentSize": { "index": 7, "kind": "property", "displayName": "Max Segment Size", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 500, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "Maximum size of one segment, in characters." }, + "autowiredEnabled": { "index": 8, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." }, + "documentSplitter": { "index": 9, "kind": "property", "displayName": "Document Splitter", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "dev.langchain4j.data.document.DocumentSplitter", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The DocumentSplitter deciding how a document becomes segments, referenced as #bean:name - LangChain4j ships alternatives beside the default recursive one. When set, maxSegmentSize and maxOverlapSize are ignored (they parameterize the default splitter only). Segments returned without the identity metadata are re-stamped, so a custom splitter cannot break citation. Not looked up by type on purpose - an application may hold unrelated splitters." }, + "idempotentRepository": { "index": 10, "kind": "property", "displayName": "Idempotent Repository", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.IdempotentRepository", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The IdempotentRepository remembering already ingested document ids, referenced as #bean:name. When set, a delivery whose id was already written is answered with a skipped result instead of being re-ingested: first write wins per id. A blank document releases its claim, so a later, populated delivery under the same id still ingests. The claim is eager: a duplicate racing an in-flight first delivery is answered skipped even if that delivery then fails - with an at-least-once source the skipped duplicate is acknowledged and the failed original may be the only other copy, so pair eager deduplication with a source that redelivers on failure. Not looked up by type on purpose - an application may hold unrelated idempotent repositories. The repository is started but never stopped by the endpoint (it may be shared); a persistent repository's lifecycle belongs to whoever created it." }, + "maxDocumentSize": { "index": 11, "kind": "property", "displayName": "Max Document Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "Maximum size of one document in characters, applied to the text about to be split; 0, the default, means no limit. The pipeline holds a document in memory whole, so the cap is the protection against oversized - on a consumer-fed pipeline, attacker-sized - payloads. An oversized document fails the exchange cleanly and, with a repository configured, releases its dedup claim." } + }, + "headers": { + "CamelLangChain4jIngestDocumentId": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The stable document id of the ingested payload, read when the documentIdHeader endpoint option does not name another header. The CamelLangChain4jIngestDocumentId exchange property, when set, takes precedence over any header.", "constantName": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestHeaders#DOCUMENT_ID" } + }, + "properties": { + "pipelineName": { "index": 0, "kind": "path", "displayName": "Pipeline Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The pipeline name, stamped on every written segment as the camel_ingest_pipeline metadata and used in error messages" }, + "documentIdHeader": { "index": 1, "kind": "parameter", "displayName": "Document Id Header", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "CamelLangChain4jIngestDocumentId", "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "Name of the header carrying the document id, such as CamelAwsS3Key for an S3 consumer or CamelKafkaKey for a Kafka one. The CamelLangChain4jIngestDocumentId exchange property, when set, takes precedence - a route that parses documents captures the id into that property before the parse, so a document cannot forge its own identity. An exchange without an id fails." }, + "embeddingBatchSize": { "index": 2, "kind": "parameter", "displayName": "Embedding Batch Size", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 32, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "How many segments are embedded per request to the embedding model. Providers with generous per-request limits ingest large documents faster with a bigger batch; a batch carries at most embeddingBatchSize x maxSegmentSize characters, so tune the two together against the provider's token limits." }, + "embeddingModel": { "index": 3, "kind": "parameter", "displayName": "Embedding Model", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "dev.langchain4j.model.embedding.EmbeddingModel", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The EmbeddingModel to embed segments with. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option." }, + "embeddingStore": { "index": 4, "kind": "parameter", "displayName": "Embedding Store", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "dev.langchain4j.store.embedding.EmbeddingStore", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The EmbeddingStore to write segments to. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option." }, + "maxOverlapSize": { "index": 5, "kind": "parameter", "displayName": "Max Overlap Size", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 50, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "How much of the previous segment each segment repeats, in characters. Overlap keeps a sentence split across a boundary retrievable from either side." }, + "maxSegmentSize": { "index": 6, "kind": "parameter", "displayName": "Max Segment Size", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 500, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "Maximum size of one segment, in characters." }, + "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 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." }, + "documentSplitter": { "index": 8, "kind": "parameter", "displayName": "Document Splitter", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "dev.langchain4j.data.document.DocumentSplitter", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The DocumentSplitter deciding how a document becomes segments, referenced as #bean:name - LangChain4j ships alternatives beside the default recursive one. When set, maxSegmentSize and maxOverlapSize are ignored (they parameterize the default splitter only). Segments returned without the identity metadata are re-stamped, so a custom splitter cannot break citation. Not looked up by type on purpose - an application may hold unrelated splitters." }, + "idempotentRepository": { "index": 9, "kind": "parameter", "displayName": "Idempotent Repository", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.IdempotentRepository", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "The IdempotentRepository remembering already ingested document ids, referenced as #bean:name. When set, a delivery whose id was already written is answered with a skipped result instead of being re-ingested: first write wins per id. A blank document releases its claim, so a later, populated delivery under the same id still ingests. The claim is eager: a duplicate racing an in-flight first delivery is answered skipped even if that delivery then fails - with an at-least-once source the skipped duplicate is acknowledged and the failed original may be the only other copy, so pair eager deduplication with a source that redelivers on failure. Not looked up by type on purpose - an application may hold unrelated idempotent repositories. The repository is started but never stopped by the endpoint (it may be shared); a persistent repository's lifecycle belongs to whoever created it." }, + "maxDocumentSize": { "index": 10, "kind": "parameter", "displayName": "Max Document Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "configurationClass": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", "configurationField": "configuration", "description": "Maximum size of one document in characters, applied to the text about to be split; 0, the default, means no limit. The pipeline holds a document in memory whole, so the cap is the protection against oversized - on a consumer-fed pipeline, attacker-sized - payloads. An oversized document fails the exchange cleanly and, with a repository configured, releases its dedup claim." } + } +} diff --git a/components-starter/camel-langchain4j-ingest-starter/pom.xml b/components-starter/camel-langchain4j-ingest-starter/pom.xml new file mode 100644 index 000000000000..36eb327528f8 --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-langchain4j-ingest-starter + jar + Camel SB Starters :: langchain4j-ingest + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-langchain4j-ingest + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-langchain4j-ingest-starter/src/main/docs/langchain4j-ingest.json b/components-starter/camel-langchain4j-ingest-starter/src/main/docs/langchain4j-ingest.json new file mode 100644 index 000000000000..0ea26ff77500 --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/main/docs/langchain4j-ingest.json @@ -0,0 +1,111 @@ +{ + "groups": [ + { + "name": "camel.component.langchain4j-ingest", + "type": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration" + }, + { + "name": "camel.component.langchain4j-ingest.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.langchain4j-ingest.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.langchain4j-ingest.configuration", + "type": "org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration", + "description": "The configuration. The option is a org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration type.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration" + }, + { + "name": "camel.component.langchain4j-ingest.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.langchain4j-ingest.document-id-header", + "type": "java.lang.String", + "description": "Name of the header carrying the document id, such as CamelAwsS3Key for an S3 consumer or CamelKafkaKey for a Kafka one. The CamelLangChain4jIngestDocumentId exchange property, when set, takes precedence - a route that parses documents captures the id into that property before the parse, so a document cannot forge its own identity. An exchange without an id fails.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "defaultValue": "CamelLangChain4jIngestDocumentId" + }, + { + "name": "camel.component.langchain4j-ingest.document-splitter", + "type": "dev.langchain4j.data.document.DocumentSplitter", + "description": "The DocumentSplitter deciding how a document becomes segments, referenced as #bean:name - LangChain4j ships alternatives beside the default recursive one. When set, maxSegmentSize and maxOverlapSize are ignored (they parameterize the default splitter only). Segments returned without the identity metadata are re-stamped, so a custom splitter cannot break citation. Not looked up by type on purpose - an application may hold unrelated splitters. The option is a dev.langchain4j.data.document.DocumentSplitter type.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration" + }, + { + "name": "camel.component.langchain4j-ingest.embedding-batch-size", + "type": "java.lang.Integer", + "description": "How many segments are embedded per request to the embedding model. Providers with generous per-request limits ingest large documents faster with a bigger batch; a batch carries at most embeddingBatchSize x maxSegmentSize characters, so tune the two together against the provider's token limits.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "defaultValue": 32 + }, + { + "name": "camel.component.langchain4j-ingest.embedding-model", + "type": "dev.langchain4j.model.embedding.EmbeddingModel", + "description": "The EmbeddingModel to embed segments with. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option. The option is a dev.langchain4j.model.embedding.EmbeddingModel type.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration" + }, + { + "name": "camel.component.langchain4j-ingest.embedding-store", + "type": "dev.langchain4j.store.embedding.EmbeddingStore", + "description": "The EmbeddingStore to write segments to. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option. The option is a dev.langchain4j.store.embedding.EmbeddingStore type.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration" + }, + { + "name": "camel.component.langchain4j-ingest.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the langchain4j-ingest component. This is enabled by default.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration" + }, + { + "name": "camel.component.langchain4j-ingest.idempotent-repository", + "type": "org.apache.camel.spi.IdempotentRepository", + "description": "The IdempotentRepository remembering already ingested document ids, referenced as #bean:name. When set, a delivery whose id was already written is answered with a skipped result instead of being re-ingested: first write wins per id. A blank document releases its claim, so a later, populated delivery under the same id still ingests. The claim is eager: a duplicate racing an in-flight first delivery is answered skipped even if that delivery then fails - with an at-least-once source the skipped duplicate is acknowledged and the failed original may be the only other copy, so pair eager deduplication with a source that redelivers on failure. Not looked up by type on purpose - an application may hold unrelated idempotent repositories. The repository is started but never stopped by the endpoint (it may be shared); a persistent repository's lifecycle belongs to whoever created it. The option is a org.apache.camel.spi.IdempotentRepository type.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration" + }, + { + "name": "camel.component.langchain4j-ingest.lazy-start-producer", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.langchain4j-ingest.max-document-size", + "type": "java.lang.Integer", + "description": "Maximum size of one document in characters, applied to the text about to be split; 0, the default, means no limit. The pipeline holds a document in memory whole, so the cap is the protection against oversized - on a consumer-fed pipeline, attacker-sized - payloads. An oversized document fails the exchange cleanly and, with a repository configured, releases its dedup claim.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "defaultValue": 0 + }, + { + "name": "camel.component.langchain4j-ingest.max-overlap-size", + "type": "java.lang.Integer", + "description": "How much of the previous segment each segment repeats, in characters. Overlap keeps a sentence split across a boundary retrievable from either side.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "defaultValue": 50 + }, + { + "name": "camel.component.langchain4j-ingest.max-segment-size", + "type": "java.lang.Integer", + "description": "Maximum size of one segment, in characters.", + "sourceType": "org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration", + "defaultValue": 500 + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfiguration.java b/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfiguration.java new file mode 100644 index 000000000000..8a7268c7d2b3 --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.langchain4j.ingest.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.langchain4j.ingest.LangChain4jIngestComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = {CamelAutoConfiguration.class, LangChain4jIngestComponentConverter.class}) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,LangChain4jIngestComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.langchain4j-ingest"}) +public class LangChain4jIngestComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final LangChain4jIngestComponentConfiguration configuration; + + public LangChain4jIngestComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureLangChain4jIngestComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.langchain4j-ingest", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.langchain4j-ingest.customizer") + && target instanceof LangChain4jIngestComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConfiguration.java b/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConfiguration.java new file mode 100644 index 000000000000..346d160dc00e --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConfiguration.java @@ -0,0 +1,244 @@ +/* + * 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.component.langchain4j.ingest.springboot; + +import dev.langchain4j.data.document.DocumentSplitter; +import dev.langchain4j.data.segment.TextSegment; +import dev.langchain4j.model.embedding.EmbeddingModel; +import dev.langchain4j.store.embedding.EmbeddingStore; +import org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration; +import org.apache.camel.spi.IdempotentRepository; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Ingest documents into a LangChain4j EmbeddingStore: split, embed and store + * the message body. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.langchain4j-ingest") +public class LangChain4jIngestComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the langchain4j-ingest component. + * This is enabled by default. + */ + private Boolean enabled; + /** + * The configuration. The option is a + * org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration type. + */ + private LangChain4jIngestConfiguration configuration; + /** + * Name of the header carrying the document id, such as CamelAwsS3Key for an + * S3 consumer or CamelKafkaKey for a Kafka one. The + * CamelLangChain4jIngestDocumentId exchange property, when set, takes + * precedence - a route that parses documents captures the id into that + * property before the parse, so a document cannot forge its own identity. + * An exchange without an id fails. + */ + private String documentIdHeader = "CamelLangChain4jIngestDocumentId"; + /** + * How many segments are embedded per request to the embedding model. + * Providers with generous per-request limits ingest large documents faster + * with a bigger batch; a batch carries at most embeddingBatchSize x + * maxSegmentSize characters, so tune the two together against the + * provider's token limits. + */ + private Integer embeddingBatchSize = 32; + /** + * The EmbeddingModel to embed segments with. When not set, the single bean + * of that type in the registry is used; zero or several beans fail the + * endpoint start with an error naming this option. The option is a + * dev.langchain4j.model.embedding.EmbeddingModel type. + */ + private EmbeddingModel embeddingModel; + /** + * The EmbeddingStore to write segments to. When not set, the single bean of + * that type in the registry is used; zero or several beans fail the + * endpoint start with an error naming this option. The option is a + * dev.langchain4j.store.embedding.EmbeddingStore type. + */ + private EmbeddingStore embeddingStore; + /** + * 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. + */ + private Boolean lazyStartProducer = false; + /** + * How much of the previous segment each segment repeats, in characters. + * Overlap keeps a sentence split across a boundary retrievable from either + * side. + */ + private Integer maxOverlapSize = 50; + /** + * Maximum size of one segment, in characters. + */ + private Integer maxSegmentSize = 500; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + /** + * The DocumentSplitter deciding how a document becomes segments, referenced + * as #bean:name - LangChain4j ships alternatives beside the default + * recursive one. When set, maxSegmentSize and maxOverlapSize are ignored + * (they parameterize the default splitter only). Segments returned without + * the identity metadata are re-stamped, so a custom splitter cannot break + * citation. Not looked up by type on purpose - an application may hold + * unrelated splitters. The option is a + * dev.langchain4j.data.document.DocumentSplitter type. + */ + private DocumentSplitter documentSplitter; + /** + * The IdempotentRepository remembering already ingested document ids, + * referenced as #bean:name. When set, a delivery whose id was already + * written is answered with a skipped result instead of being re-ingested: + * first write wins per id. A blank document releases its claim, so a later, + * populated delivery under the same id still ingests. The claim is eager: a + * duplicate racing an in-flight first delivery is answered skipped even if + * that delivery then fails - with an at-least-once source the skipped + * duplicate is acknowledged and the failed original may be the only other + * copy, so pair eager deduplication with a source that redelivers on + * failure. Not looked up by type on purpose - an application may hold + * unrelated idempotent repositories. The repository is started but never + * stopped by the endpoint (it may be shared); a persistent repository's + * lifecycle belongs to whoever created it. The option is a + * org.apache.camel.spi.IdempotentRepository type. + */ + private IdempotentRepository idempotentRepository; + /** + * Maximum size of one document in characters, applied to the text about to + * be split; 0, the default, means no limit. The pipeline holds a document + * in memory whole, so the cap is the protection against oversized - on a + * consumer-fed pipeline, attacker-sized - payloads. An oversized document + * fails the exchange cleanly and, with a repository configured, releases + * its dedup claim. + */ + private Integer maxDocumentSize = 0; + + public LangChain4jIngestConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(LangChain4jIngestConfiguration configuration) { + this.configuration = configuration; + } + + public String getDocumentIdHeader() { + return documentIdHeader; + } + + public void setDocumentIdHeader(String documentIdHeader) { + this.documentIdHeader = documentIdHeader; + } + + public Integer getEmbeddingBatchSize() { + return embeddingBatchSize; + } + + public void setEmbeddingBatchSize(Integer embeddingBatchSize) { + this.embeddingBatchSize = embeddingBatchSize; + } + + public EmbeddingModel getEmbeddingModel() { + return embeddingModel; + } + + public void setEmbeddingModel(EmbeddingModel embeddingModel) { + this.embeddingModel = embeddingModel; + } + + public EmbeddingStore getEmbeddingStore() { + return embeddingStore; + } + + public void setEmbeddingStore(EmbeddingStore embeddingStore) { + this.embeddingStore = embeddingStore; + } + + public Boolean getLazyStartProducer() { + return lazyStartProducer; + } + + public void setLazyStartProducer(Boolean lazyStartProducer) { + this.lazyStartProducer = lazyStartProducer; + } + + public Integer getMaxOverlapSize() { + return maxOverlapSize; + } + + public void setMaxOverlapSize(Integer maxOverlapSize) { + this.maxOverlapSize = maxOverlapSize; + } + + public Integer getMaxSegmentSize() { + return maxSegmentSize; + } + + public void setMaxSegmentSize(Integer maxSegmentSize) { + this.maxSegmentSize = maxSegmentSize; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } + + public DocumentSplitter getDocumentSplitter() { + return documentSplitter; + } + + public void setDocumentSplitter(DocumentSplitter documentSplitter) { + this.documentSplitter = documentSplitter; + } + + public IdempotentRepository getIdempotentRepository() { + return idempotentRepository; + } + + public void setIdempotentRepository( + IdempotentRepository idempotentRepository) { + this.idempotentRepository = idempotentRepository; + } + + public Integer getMaxDocumentSize() { + return maxDocumentSize; + } + + public void setMaxDocumentSize(Integer maxDocumentSize) { + this.maxDocumentSize = maxDocumentSize; + } +} \ No newline at end of file diff --git a/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConverter.java b/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConverter.java new file mode 100644 index 000000000000..e45694f0e9d9 --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/main/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentConverter.java @@ -0,0 +1,57 @@ +/* + * 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.component.langchain4j.ingest.springboot; + +import java.util.LinkedHashSet; +import java.util.Set; +import org.apache.camel.spring.boot.util.BeanReferenceHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.stereotype.Component; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@ConfigurationPropertiesBinding +@Component +public class LangChain4jIngestComponentConverter implements GenericConverter { + + @Autowired + private ApplicationContext applicationContext; + + public Set getConvertibleTypes() { + Set answer = new LinkedHashSet<>(); + answer.add(new ConvertiblePair(String.class, org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration.class)); + answer.add(new ConvertiblePair(String.class, dev.langchain4j.model.embedding.EmbeddingModel.class)); + answer.add(new ConvertiblePair(String.class, dev.langchain4j.store.embedding.EmbeddingStore.class)); + answer.add(new ConvertiblePair(String.class, dev.langchain4j.data.document.DocumentSplitter.class)); + answer.add(new ConvertiblePair(String.class, org.apache.camel.spi.IdempotentRepository.class)); + return answer; + } + + public Object convert( + Object source, + TypeDescriptor sourceType, + TypeDescriptor targetType) { + return BeanReferenceHelper.resolveBeanReference(applicationContext, source, targetType, "camel.component.langchain4j-ingest"); + } +} \ No newline at end of file diff --git a/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..931ca09e5432 --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentConverter +org.apache.camel.component.langchain4j.ingest.springboot.LangChain4jIngestComponentAutoConfiguration diff --git a/components-starter/camel-langchain4j-ingest-starter/src/test/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfigurationTest.java b/components-starter/camel-langchain4j-ingest-starter/src/test/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..a3890f35851c --- /dev/null +++ b/components-starter/camel-langchain4j-ingest-starter/src/test/java/org/apache/camel/component/langchain4j/ingest/springboot/LangChain4jIngestComponentAutoConfigurationTest.java @@ -0,0 +1,57 @@ +/* + * 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.component.langchain4j.ingest.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.langchain4j.ingest.LangChain4jIngestComponent; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, LangChain4jIngestComponentAutoConfiguration.class }, + properties = { + "camel.component.langchain4j-ingest.max-segment-size = 1000", + "camel.component.langchain4j-ingest.max-overlap-size = 100", + "camel.component.langchain4j-ingest.document-id-header = MyDocumentId" }) +public class LangChain4jIngestComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + LangChain4jIngestComponent component = assertInstanceOf(LangChain4jIngestComponent.class, + context.getComponent("langchain4j-ingest")); + + // set through camel.component.langchain4j-ingest.*, so this asserts the Spring + // Boot properties are copied onto the component's nested + // LangChain4jIngestConfiguration by the starter + assertEquals(1000, component.getConfiguration().getMaxSegmentSize()); + assertEquals(100, component.getConfiguration().getMaxOverlapSize()); + assertEquals("MyDocumentId", component.getConfiguration().getDocumentIdHeader()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index 6305e67bb887..c0e48fd43c08 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -353,6 +353,7 @@ camel-langchain4j-chat-starter camel-langchain4j-embeddings-starter camel-langchain4j-embeddingstore-starter + camel-langchain4j-ingest-starter camel-langchain4j-tokenizer-starter camel-langchain4j-web-search-starter camel-language-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index c26db1ac94c6..20a46153d789 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -252,6 +252,7 @@ ** xref:starters/langchain4j-chat.adoc[LangChain4j Chat] ** xref:starters/langchain4j-embeddings.adoc[LangChain4j Embeddings] ** xref:starters/langchain4j-embeddingstore.adoc[LangChain4j Embedding Store] +** xref:starters/langchain4j-ingest.adoc[LangChain4j Ingest] ** xref:starters/langchain4j-tokenizer.adoc[Langchain4j Tokenizer] ** xref:starters/langchain4j-web-search.adoc[LangChain4j Web Search] ** xref:starters/language.adoc[Language] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/langchain4j-ingest.adoc b/docs/spring-boot/modules/ROOT/pages/starters/langchain4j-ingest.adoc new file mode 100644 index 000000000000..f30508889237 --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/langchain4j-ingest.adoc @@ -0,0 +1,44 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += LangChain4j Ingest +:artifactid: camel-langchain4j-ingest-starter + +Ingest documents into a LangChain4j EmbeddingStore: split, embed and store the message body. + +== What's inside + +* xref:{csb-camel-components}::langchain4j-ingest-component.adoc[LangChain4j Ingest component], URI syntax: `langchain4j-ingest:pipelineName` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-langchain4j-ingest-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 13 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.langchain4j-ingest.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.langchain4j-ingest.configuration | The configuration. The option is a org.apache.camel.component.langchain4j.ingest.LangChain4jIngestConfiguration type. | | LangChain4jIngestConfiguration +| camel.component.langchain4j-ingest.document-id-header | Name of the header carrying the document id, such as CamelAwsS3Key for an S3 consumer or CamelKafkaKey for a Kafka one. The CamelLangChain4jIngestDocumentId exchange property, when set, takes precedence - a route that parses documents captures the id into that property before the parse, so a document cannot forge its own identity. An exchange without an id fails. | CamelLangChain4jIngestDocumentId | String +| camel.component.langchain4j-ingest.document-splitter | The DocumentSplitter deciding how a document becomes segments, referenced as #bean:name - LangChain4j ships alternatives beside the default recursive one. When set, maxSegmentSize and maxOverlapSize are ignored (they parameterize the default splitter only). Segments returned without the identity metadata are re-stamped, so a custom splitter cannot break citation. Not looked up by type on purpose - an application may hold unrelated splitters. The option is a dev.langchain4j.data.document.DocumentSplitter type. | | DocumentSplitter +| camel.component.langchain4j-ingest.embedding-batch-size | How many segments are embedded per request to the embedding model. Providers with generous per-request limits ingest large documents faster with a bigger batch; a batch carries at most embeddingBatchSize x maxSegmentSize characters, so tune the two together against the provider's token limits. | 32 | Integer +| camel.component.langchain4j-ingest.embedding-model | The EmbeddingModel to embed segments with. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option. The option is a dev.langchain4j.model.embedding.EmbeddingModel type. | | EmbeddingModel +| camel.component.langchain4j-ingest.embedding-store | The EmbeddingStore to write segments to. When not set, the single bean of that type in the registry is used; zero or several beans fail the endpoint start with an error naming this option. The option is a dev.langchain4j.store.embedding.EmbeddingStore type. | | TextSegment> +| camel.component.langchain4j-ingest.enabled | Whether to enable auto configuration of the langchain4j-ingest component. This is enabled by default. | | Boolean +| camel.component.langchain4j-ingest.idempotent-repository | The IdempotentRepository remembering already ingested document ids, referenced as #bean:name. When set, a delivery whose id was already written is answered with a skipped result instead of being re-ingested: first write wins per id. A blank document releases its claim, so a later, populated delivery under the same id still ingests. The claim is eager: a duplicate racing an in-flight first delivery is answered skipped even if that delivery then fails - with an at-least-once source the skipped duplicate is acknowledged and the failed original may be the only other copy, so pair eager deduplication with a source that redelivers on failure. Not looked up by type on purpose - an application may hold unrelated idempotent repositories. The repository is started but never stopped by the endpoint (it may be shared); a persistent repository's lifecycle belongs to whoever created it. The option is a org.apache.camel.spi.IdempotentRepository type. | | IdempotentRepository +| camel.component.langchain4j-ingest.lazy-start-producer | 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. | false | Boolean +| camel.component.langchain4j-ingest.max-document-size | Maximum size of one document in characters, applied to the text about to be split; 0, the default, means no limit. The pipeline holds a document in memory whole, so the cap is the protection against oversized - on a consumer-fed pipeline, attacker-sized - payloads. An oversized document fails the exchange cleanly and, with a repository configured, releases its dedup claim. | 0 | Integer +| camel.component.langchain4j-ingest.max-overlap-size | How much of the previous segment each segment repeats, in characters. Overlap keeps a sentence split across a boundary retrievable from either side. | 50 | Integer +| camel.component.langchain4j-ingest.max-segment-size | Maximum size of one segment, in characters. | 500 | Integer +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 3fe3b30623ec..1143323c96ce 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -1622,6 +1622,11 @@ camel-langchain4j-embeddingstore-starter ${project.version} + + org.apache.camel.springboot + camel-langchain4j-ingest-starter + ${project.version} + org.apache.camel.springboot camel-langchain4j-tokenizer-starter From 958b573f386abc54bad242ba66b4c1a769dccbe8 Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 15 Sep 2026 13:44:05 +0200 Subject: [PATCH 9/9] Add camel-ibm-watsonx-data-starter camel-ibm-watsonx-data interacts with the IBM watsonx.data lakehouse for catalog, schema, table and engine management but never got a Spring Boot starter. Generate it with starter-create and regenerate the docs, catalog and dependencies BOM entries. Add a smoke test verifying camel.component.ibm-watsonx-data.* Spring Boot properties are copied onto the component's nested WatsonxDataConfiguration. Co-Authored-By: Claude Sonnet 5 --- .../springboot/catalog/components.properties | 1 + .../catalog/components/ibm-watsonx-data.json | 67 ++++++ .../camel-ibm-watsonx-data-starter/pom.xml | 48 +++++ .../src/main/docs/ibm-watsonx-data.json | 100 +++++++++ ...WatsonxDataComponentAutoConfiguration.java | 74 +++++++ .../WatsonxDataComponentConfiguration.java | 190 ++++++++++++++++ .../WatsonxDataComponentConverter.java | 53 +++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + ...ot.autoconfigure.AutoConfiguration.imports | 18 ++ ...onxDataComponentAutoConfigurationTest.java | 57 +++++ components-starter/pom.xml | 1 + docs/spring-boot/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/starters/ibm-watsonx-data.adoc | 43 ++++ .../camel-spring-boot-dependencies/pom.xml | 5 + 15 files changed, 872 insertions(+) create mode 100644 catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ibm-watsonx-data.json create mode 100644 components-starter/camel-ibm-watsonx-data-starter/pom.xml create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/main/docs/ibm-watsonx-data.json create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfiguration.java create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConfiguration.java create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConverter.java create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/LICENSE.txt create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/NOTICE.txt create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 components-starter/camel-ibm-watsonx-data-starter/src/test/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfigurationTest.java create mode 100644 docs/spring-boot/modules/ROOT/pages/starters/ibm-watsonx-data.adoc diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties index 003c235048d6..2a8d088246f0 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components.properties @@ -191,6 +191,7 @@ ibm-watson-language ibm-watson-speech-to-text ibm-watson-text-to-speech ibm-watsonx-ai +ibm-watsonx-data iggy ignite-cache ignite-compute diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ibm-watsonx-data.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ibm-watsonx-data.json new file mode 100644 index 000000000000..011b596a1919 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/ibm-watsonx-data.json @@ -0,0 +1,67 @@ +{ + "component": { + "kind": "component", + "name": "ibm-watsonx-data", + "title": "IBM watsonx.data", + "description": "Interact with IBM watsonx.data lakehouse for catalog, schema, table, and engine management.", + "deprecated": false, + "firstVersion": "4.19.0", + "label": "cloud,database", + "javaType": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataComponent", + "supportLevel": "Stable", + "groupId": "org.apache.camel.springboot", + "artifactId": "camel-ibm-watsonx-data-starter", + "version": "4.23.0-SNAPSHOT", + "scheme": "ibm-watsonx-data", + "extendsScheme": "", + "syntax": "ibm-watsonx-data:label", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "authInstanceId": { "index": 0, "kind": "property", "displayName": "Auth Instance Id", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The watsonx.data instance CRN for API authorization" }, + "serviceUrl": { "index": 1, "kind": "property", "displayName": "Service Url", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The watsonx.data service URL (e.g., https:\/\/region.lakehouse.cloud.ibm.com\/lakehouse\/api\/v2)" }, + "catalogName": { "index": 2, "kind": "property", "displayName": "Catalog Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The catalog name for catalog, schema, and table operations" }, + "configuration": { "index": 3, "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configuration" }, + "engineId": { "index": 4, "kind": "property", "displayName": "Engine Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The engine ID for engine operations and schema\/table queries" }, + "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 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." }, + "operation": { "index": 6, "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataOperations", "enum": [ "listCatalogs", "getCatalog", "deleteCatalog", "listSchemas", "createSchema", "deleteSchema", "listTables", "getTable", "deleteTable", "updateTable", "registerTable", "getAllColumns", "listPrestoEngines", "getPrestoEngine", "listPrestissimoEngines", "getPrestissimoEngine", "listStorageRegistrations", "createStorageRegistration" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, + "schemaName": { "index": 7, "kind": "property", "displayName": "Schema Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The schema name for schema and table operations" }, + "autowiredEnabled": { "index": 8, "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." }, + "apiKey": { "index": 9, "kind": "property", "displayName": "Api Key", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "security": "secret", "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "IBM Cloud API key for authentication" }, + "oauthProfile": { "index": 10, "kind": "property", "displayName": "Oauth Profile", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token is acquired from the configured identity provider and used as apiKey. Requires camel-oauth on the classpath." } + }, + "headers": { + "CamelIBMWatsonxDataOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "WatsonxDataOperations", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#OPERATION" }, + "CamelIBMWatsonxDataCatalogName": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The catalog name", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#CATALOG_NAME" }, + "CamelIBMWatsonxDataSchemaName": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The schema name", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#SCHEMA_NAME" }, + "CamelIBMWatsonxDataCustomPath": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The custom path for schema creation", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#CUSTOM_PATH" }, + "CamelIBMWatsonxDataTableName": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The table name", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#TABLE_NAME" }, + "CamelIBMWatsonxDataMetadataLocation": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The metadata location for table registration (e.g., S3 path to Iceberg metadata)", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#METADATA_LOCATION" }, + "CamelIBMWatsonxDataCatalogId": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The catalog ID for table registration", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#CATALOG_ID" }, + "CamelIBMWatsonxDataSchemaId": { "index": 7, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The schema ID for table registration", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#SCHEMA_ID" }, + "CamelIBMWatsonxDataEngineId": { "index": 8, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The engine ID", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#ENGINE_ID" }, + "CamelIBMWatsonxDataStorageDescription": { "index": 9, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The storage description for registration", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#STORAGE_DESCRIPTION" }, + "CamelIBMWatsonxDataStorageDisplayName": { "index": 10, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The storage display name for registration", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#STORAGE_DISPLAY_NAME" }, + "CamelIBMWatsonxDataStorageManagedBy": { "index": 11, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The storage managed by value (e.g., ibm, customer)", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#STORAGE_MANAGED_BY" }, + "CamelIBMWatsonxDataStorageType": { "index": 12, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The storage type (e.g., ibm_cos, aws_s3, google_cs)", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#STORAGE_TYPE" }, + "CamelIBMWatsonxDataAuthInstanceId": { "index": 13, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The auth instance ID for watsonx.data API calls", "constantName": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConstants#AUTH_INSTANCE_ID" } + }, + "properties": { + "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Logical name for the endpoint" }, + "authInstanceId": { "index": 1, "kind": "parameter", "displayName": "Auth Instance Id", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The watsonx.data instance CRN for API authorization" }, + "serviceUrl": { "index": 2, "kind": "parameter", "displayName": "Service Url", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The watsonx.data service URL (e.g., https:\/\/region.lakehouse.cloud.ibm.com\/lakehouse\/api\/v2)" }, + "catalogName": { "index": 3, "kind": "parameter", "displayName": "Catalog Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The catalog name for catalog, schema, and table operations" }, + "engineId": { "index": 4, "kind": "parameter", "displayName": "Engine Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The engine ID for engine operations and schema\/table queries" }, + "operation": { "index": 5, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataOperations", "enum": [ "listCatalogs", "getCatalog", "deleteCatalog", "listSchemas", "createSchema", "deleteSchema", "listTables", "getTable", "deleteTable", "updateTable", "registerTable", "getAllColumns", "listPrestoEngines", "getPrestoEngine", "listPrestissimoEngines", "getPrestissimoEngine", "listStorageRegistrations", "createStorageRegistration" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, + "schemaName": { "index": 6, "kind": "parameter", "displayName": "Schema Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "The schema name for schema and table operations" }, + "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 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." }, + "apiKey": { "index": 8, "kind": "parameter", "displayName": "Api Key", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "security": "secret", "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "IBM Cloud API key for authentication" }, + "oauthProfile": { "index": 9, "kind": "parameter", "displayName": "Oauth Profile", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", "configurationField": "configuration", "description": "OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token is acquired from the configured identity provider and used as apiKey. Requires camel-oauth on the classpath." } + } +} diff --git a/components-starter/camel-ibm-watsonx-data-starter/pom.xml b/components-starter/camel-ibm-watsonx-data-starter/pom.xml new file mode 100644 index 000000000000..d1588fae4613 --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.camel.springboot + components-starter + 4.23.0-SNAPSHOT + + camel-ibm-watsonx-data-starter + jar + Camel SB Starters :: ibm-watsonx-data + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.camel + camel-ibm-watsonx-data + ${camel-version} + + + + org.apache.camel.springboot + camel-core-starter + + + + diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/main/docs/ibm-watsonx-data.json b/components-starter/camel-ibm-watsonx-data-starter/src/main/docs/ibm-watsonx-data.json new file mode 100644 index 000000000000..465a880337dc --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/main/docs/ibm-watsonx-data.json @@ -0,0 +1,100 @@ +{ + "groups": [ + { + "name": "camel.component.ibm-watsonx-data", + "type": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.customizer", + "type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.component.ibm-watsonx-data.api-key", + "type": "java.lang.String", + "description": "IBM Cloud API key for authentication", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.auth-instance-id", + "type": "java.lang.String", + "description": "The watsonx.data instance CRN for API authorization", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.autowired-enabled", + "type": "java.lang.Boolean", + "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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration", + "defaultValue": true + }, + { + "name": "camel.component.ibm-watsonx-data.catalog-name", + "type": "java.lang.String", + "description": "The catalog name for catalog, schema, and table operations", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.configuration", + "type": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration", + "description": "The component configuration. The option is a org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration type.", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.component.ibm-watsonx-data.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the ibm-watsonx-data component. This is enabled by default.", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.engine-id", + "type": "java.lang.String", + "description": "The engine ID for engine operations and schema\/table queries", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.lazy-start-producer", + "type": "java.lang.Boolean", + "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 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.", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.ibm-watsonx-data.oauth-profile", + "type": "java.lang.String", + "description": "OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token is acquired from the configured identity provider and used as apiKey. Requires camel-oauth on the classpath.", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.operation", + "type": "org.apache.camel.component.ibm.watsonx.data.WatsonxDataOperations", + "description": "The operation to perform", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.schema-name", + "type": "java.lang.String", + "description": "The schema name for schema and table operations", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + }, + { + "name": "camel.component.ibm-watsonx-data.service-url", + "type": "java.lang.String", + "description": "The watsonx.data service URL (e.g., https:\/\/region.lakehouse.cloud.ibm.com\/lakehouse\/api\/v2)", + "sourceType": "org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration" + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} \ No newline at end of file diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfiguration.java b/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfiguration.java new file mode 100644 index 000000000000..9e3e3568e48f --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfiguration.java @@ -0,0 +1,74 @@ +/* + * 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.component.ibm.watsonx.data.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.component.ibm.watsonx.data.WatsonxDataComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@AutoConfiguration(after = {CamelAutoConfiguration.class, WatsonxDataComponentConverter.class}) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class,WatsonxDataComponentConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.component", "camel.component.ibm-watsonx-data"}) +public class WatsonxDataComponentAutoConfiguration { + + private final ApplicationContext applicationContext; + private final WatsonxDataComponentConfiguration configuration; + + public WatsonxDataComponentAutoConfiguration( + org.springframework.context.ApplicationContext applicationContext, + org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConfiguration configuration) { + this.applicationContext = applicationContext; + this.configuration = configuration; + } + + @Lazy + @Bean + public ComponentCustomizer configureWatsonxDataComponent() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + CamelPropertiesHelper.copyConfigurationProperties(target.getCamelContext(), applicationContext, + "camel.component.ibm-watsonx-data", configuration, target); + } + @Override + public boolean isEnabled(String name, Component target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.component.customizer", + "camel.component.ibm-watsonx-data.customizer") + && target instanceof WatsonxDataComponent; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConfiguration.java b/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConfiguration.java new file mode 100644 index 000000000000..ac7cf665332c --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConfiguration.java @@ -0,0 +1,190 @@ +/* + * 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.component.ibm.watsonx.data.springboot; + +import org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration; +import org.apache.camel.component.ibm.watsonx.data.WatsonxDataOperations; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Interact with IBM watsonx.data lakehouse for catalog, schema, table, and + * engine management. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.ibm-watsonx-data") +public class WatsonxDataComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the ibm-watsonx-data component. + * This is enabled by default. + */ + private Boolean enabled; + /** + * The watsonx.data instance CRN for API authorization + */ + private String authInstanceId; + /** + * The watsonx.data service URL (e.g., + * https://region.lakehouse.cloud.ibm.com/lakehouse/api/v2) + */ + private String serviceUrl; + /** + * The catalog name for catalog, schema, and table operations + */ + private String catalogName; + /** + * The component configuration. The option is a + * org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration + * type. + */ + private WatsonxDataConfiguration configuration; + /** + * The engine ID for engine operations and schema/table queries + */ + private String engineId; + /** + * 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. + */ + private Boolean lazyStartProducer = false; + /** + * The operation to perform + */ + private WatsonxDataOperations operation; + /** + * The schema name for schema and table operations + */ + private String schemaName; + /** + * 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 type, which + * then gets configured on the component. This can be used for automatic + * configuring JDBC data sources, JMS connection factories, AWS Clients, + * etc. + */ + private Boolean autowiredEnabled = true; + /** + * IBM Cloud API key for authentication + */ + private String apiKey; + /** + * OAuth profile name for obtaining an access token via the OAuth 2.0 Client + * Credentials grant. When set, the token is acquired from the configured + * identity provider and used as apiKey. Requires camel-oauth on the + * classpath. + */ + private String oauthProfile; + + public String getAuthInstanceId() { + return authInstanceId; + } + + public void setAuthInstanceId(String authInstanceId) { + this.authInstanceId = authInstanceId; + } + + public String getServiceUrl() { + return serviceUrl; + } + + public void setServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + } + + public String getCatalogName() { + return catalogName; + } + + public void setCatalogName(String catalogName) { + this.catalogName = catalogName; + } + + public WatsonxDataConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(WatsonxDataConfiguration configuration) { + this.configuration = configuration; + } + + public String getEngineId() { + return engineId; + } + + public void setEngineId(String engineId) { + this.engineId = engineId; + } + + public Boolean getLazyStartProducer() { + return lazyStartProducer; + } + + public void setLazyStartProducer(Boolean lazyStartProducer) { + this.lazyStartProducer = lazyStartProducer; + } + + public WatsonxDataOperations getOperation() { + return operation; + } + + public void setOperation(WatsonxDataOperations operation) { + this.operation = operation; + } + + public String getSchemaName() { + return schemaName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + + public Boolean getAutowiredEnabled() { + return autowiredEnabled; + } + + public void setAutowiredEnabled(Boolean autowiredEnabled) { + this.autowiredEnabled = autowiredEnabled; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getOauthProfile() { + return oauthProfile; + } + + public void setOauthProfile(String oauthProfile) { + this.oauthProfile = oauthProfile; + } +} \ No newline at end of file diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConverter.java b/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConverter.java new file mode 100644 index 000000000000..d7f38816f123 --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/main/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentConverter.java @@ -0,0 +1,53 @@ +/* + * 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.component.ibm.watsonx.data.springboot; + +import java.util.LinkedHashSet; +import java.util.Set; +import org.apache.camel.spring.boot.util.BeanReferenceHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.stereotype.Component; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@ConfigurationPropertiesBinding +@Component +public class WatsonxDataComponentConverter implements GenericConverter { + + @Autowired + private ApplicationContext applicationContext; + + public Set getConvertibleTypes() { + Set answer = new LinkedHashSet<>(); + answer.add(new ConvertiblePair(String.class, org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration.class)); + return answer; + } + + public Object convert( + Object source, + TypeDescriptor sourceType, + TypeDescriptor targetType) { + return BeanReferenceHelper.resolveBeanReference(applicationContext, source, targetType, "camel.component.ibm-watsonx-data"); + } +} \ No newline at end of file diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 000000000000..2e215bf2e6b1 --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000000..52d607b848da --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentConverter +org.apache.camel.component.ibm.watsonx.data.springboot.WatsonxDataComponentAutoConfiguration diff --git a/components-starter/camel-ibm-watsonx-data-starter/src/test/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfigurationTest.java b/components-starter/camel-ibm-watsonx-data-starter/src/test/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfigurationTest.java new file mode 100644 index 000000000000..281cd38a81b3 --- /dev/null +++ b/components-starter/camel-ibm-watsonx-data-starter/src/test/java/org/apache/camel/component/ibm/watsonx/data/springboot/WatsonxDataComponentAutoConfigurationTest.java @@ -0,0 +1,57 @@ +/* + * 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.component.ibm.watsonx.data.springboot; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.ibm.watsonx.data.WatsonxDataComponent; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit6.CamelSpringBootTest; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest(classes = { CamelAutoConfiguration.class, WatsonxDataComponentAutoConfiguration.class }, + properties = { + "camel.component.ibm-watsonx-data.service-url = https://demo.lakehouse.cloud.ibm.com/lakehouse/api/v2", + "camel.component.ibm-watsonx-data.catalog-name = demo-catalog", + "camel.component.ibm-watsonx-data.engine-id = demo-engine" }) +public class WatsonxDataComponentAutoConfigurationTest { + + @Autowired + CamelContext context; + + @Test + public void componentIsAutoConfigured() { + WatsonxDataComponent component = assertInstanceOf(WatsonxDataComponent.class, + context.getComponent("ibm-watsonx-data")); + + // set through camel.component.ibm-watsonx-data.*, so this asserts the Spring + // Boot properties are copied onto the component's nested + // WatsonxDataConfiguration by the starter + assertEquals("https://demo.lakehouse.cloud.ibm.com/lakehouse/api/v2", component.getConfiguration().getServiceUrl()); + assertEquals("demo-catalog", component.getConfiguration().getCatalogName()); + assertEquals("demo-engine", component.getConfiguration().getEngineId()); + } +} diff --git a/components-starter/pom.xml b/components-starter/pom.xml index c0e48fd43c08..09a9f15cbb90 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -292,6 +292,7 @@ camel-ibm-watson-speech-to-text-starter camel-ibm-watson-text-to-speech-starter camel-ibm-watsonx-ai-starter + camel-ibm-watsonx-data-starter camel-ical-starter camel-iggy-starter camel-ignite-starter diff --git a/docs/spring-boot/modules/ROOT/nav.adoc b/docs/spring-boot/modules/ROOT/nav.adoc index 20a46153d789..d40e12c069dd 100644 --- a/docs/spring-boot/modules/ROOT/nav.adoc +++ b/docs/spring-boot/modules/ROOT/nav.adoc @@ -191,6 +191,7 @@ ** xref:starters/ibm-watson-speech-to-text.adoc[IBM Watson Speech to Text] ** xref:starters/ibm-watson-text-to-speech.adoc[IBM Watson Text to Speech] ** xref:starters/ibm-watsonx-ai.adoc[IBM watsonx.ai] +** xref:starters/ibm-watsonx-data.adoc[IBM watsonx.data] ** xref:starters/ical.adoc[iCal] ** xref:starters/iggy.adoc[Iggy] ** xref:starters/ignite.adoc[Ignite Cache] diff --git a/docs/spring-boot/modules/ROOT/pages/starters/ibm-watsonx-data.adoc b/docs/spring-boot/modules/ROOT/pages/starters/ibm-watsonx-data.adoc new file mode 100644 index 000000000000..0739a9239bad --- /dev/null +++ b/docs/spring-boot/modules/ROOT/pages/starters/ibm-watsonx-data.adoc @@ -0,0 +1,43 @@ +// Do not edit directly! +// This file was generated by camel-spring-boot-generator-maven-plugin += IBM watsonx.data +:artifactid: camel-ibm-watsonx-data-starter + +Interact with IBM watsonx.data lakehouse for catalog, schema, table, and engine management. + +== What's inside + +* xref:{csb-camel-components}::ibm-watsonx-data-component.adoc[IBM watsonx.data component], URI syntax: `ibm-watsonx-data:label` + +Please refer to the above links for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- + + org.apache.camel.springboot + camel-ibm-watsonx-data-starter + +---- + +== Spring Boot Auto-Configuration + +The starter supports 12 options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| camel.component.ibm-watsonx-data.api-key | IBM Cloud API key for authentication | | String +| camel.component.ibm-watsonx-data.auth-instance-id | The watsonx.data instance CRN for API authorization | | String +| camel.component.ibm-watsonx-data.autowired-enabled | 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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean +| camel.component.ibm-watsonx-data.catalog-name | The catalog name for catalog, schema, and table operations | | String +| camel.component.ibm-watsonx-data.configuration | The component configuration. The option is a org.apache.camel.component.ibm.watsonx.data.WatsonxDataConfiguration type. | | WatsonxDataConfiguration +| camel.component.ibm-watsonx-data.enabled | Whether to enable auto configuration of the ibm-watsonx-data component. This is enabled by default. | | Boolean +| camel.component.ibm-watsonx-data.engine-id | The engine ID for engine operations and schema/table queries | | String +| camel.component.ibm-watsonx-data.lazy-start-producer | 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. | false | Boolean +| camel.component.ibm-watsonx-data.oauth-profile | OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token is acquired from the configured identity provider and used as apiKey. Requires camel-oauth on the classpath. | | String +| camel.component.ibm-watsonx-data.operation | The operation to perform | | WatsonxDataOperations +| camel.component.ibm-watsonx-data.schema-name | The schema name for schema and table operations | | String +| camel.component.ibm-watsonx-data.service-url | The watsonx.data service URL (e.g., https://region.lakehouse.cloud.ibm.com/lakehouse/api/v2) | | String +|=== diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 1143323c96ce..8ae2de21d06b 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -1312,6 +1312,11 @@ camel-ibm-watsonx-ai-starter ${project.version} + + org.apache.camel.springboot + camel-ibm-watsonx-data-starter + ${project.version} + org.apache.camel.springboot camel-ical-starter