This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 712a9a5 CAMEL-16650: camel-kamelet - Add option to configure location
for kamelet template to load from resource.
712a9a5 is described below
commit 712a9a5e39a4ee51b4ab6ffde01b6f3bce79e8fd
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Jun 18 19:35:03 2021 +0200
CAMEL-16650: camel-kamelet - Add option to configure location for kamelet
template to load from resource.
---
.../camel/catalog/docs/kamelet-component.adoc | 3 +-
components/camel-kamelet/pom.xml | 5 ++
.../kamelet/KameletEndpointConfigurer.java | 3 ++
.../kamelet/KameletEndpointUriFactory.java | 3 +-
.../apache/camel/component/kamelet/kamelet.json | 1 +
.../src/main/docs/kamelet-component.adoc | 3 +-
.../apache/camel/component/kamelet/Kamelet.java | 9 ++++
.../camel/component/kamelet/KameletComponent.java | 40 ++++++++++----
.../camel/component/kamelet/KameletEndpoint.java | 11 ++++
.../component/kamelet/KameletLocationTest.java | 63 ++++++++++++++++++++++
.../src/test/resources/upper-kamelet.xml | 27 ++++++++++
.../dsl/KameletEndpointBuilderFactory.java | 51 ++++++++++++++++++
.../modules/ROOT/pages/kamelet-component.adoc | 3 +-
13 files changed, 207 insertions(+), 15 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kamelet-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kamelet-component.adoc
index 07c8d02..69a3580 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kamelet-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kamelet-component.adoc
@@ -69,12 +69,13 @@ with the following path and query parameters:
|===
-=== Query Parameters (7 parameters):
+=== Query Parameters (8 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
+| *location* (common) | Location of the Kamelet to use which can be specified
as a resource from file system, classpath etc. The location cannot use
wildcards, and must refer to a file including extension, for example
file:/etc/foo-kamelet.xml | | String
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. 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
| *exceptionHandler* (consumer) | 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. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer
creates an exchange. There are 3 enums and the value can be one of: InOnly,
InOut, InOptionalOut | | ExchangePattern
diff --git a/components/camel-kamelet/pom.xml b/components/camel-kamelet/pom.xml
index 61d8b1e..5b6ea13 100644
--- a/components/camel-kamelet/pom.xml
+++ b/components/camel-kamelet/pom.xml
@@ -76,6 +76,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-xml-io-dsl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-test-junit5</artifactId>
<scope>test</scope>
</dependency>
diff --git
a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java
b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java
index 19bd60f..9883db3 100644
---
a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java
+++
b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java
@@ -32,6 +32,7 @@ public class KameletEndpointConfigurer extends
PropertyConfigurerSupport impleme
case "failIfNoConsumers":
target.setFailIfNoConsumers(property(camelContext, boolean.class, value));
return true;
case "lazystartproducer":
case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
+ case "location": target.setLocation(property(camelContext,
java.lang.String.class, value)); return true;
case "timeout": target.setTimeout(property(camelContext, long.class,
value)); return true;
default: return false;
}
@@ -51,6 +52,7 @@ public class KameletEndpointConfigurer extends
PropertyConfigurerSupport impleme
case "failIfNoConsumers": return boolean.class;
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
+ case "location": return java.lang.String.class;
case "timeout": return long.class;
default: return null;
}
@@ -71,6 +73,7 @@ public class KameletEndpointConfigurer extends
PropertyConfigurerSupport impleme
case "failIfNoConsumers": return target.isFailIfNoConsumers();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
+ case "location": return target.getLocation();
case "timeout": return target.getTimeout();
default: return null;
}
diff --git
a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointUriFactory.java
b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointUriFactory.java
index 779ede4..e437528 100644
---
a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointUriFactory.java
+++
b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointUriFactory.java
@@ -20,12 +20,13 @@ public class KameletEndpointUriFactory extends
org.apache.camel.support.componen
private static final Set<String> PROPERTY_NAMES;
private static final Set<String> SECRET_PROPERTY_NAMES;
static {
- Set<String> props = new HashSet<>(9);
+ Set<String> props = new HashSet<>(10);
props.add("lazyStartProducer");
props.add("routeId");
props.add("bridgeErrorHandler");
props.add("exchangePattern");
props.add("failIfNoConsumers");
+ props.add("location");
props.add("block");
props.add("templateId");
props.add("exceptionHandler");
diff --git
a/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json
b/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json
index e4a6af8..48b7c51 100644
---
a/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json
+++
b/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json
@@ -35,6 +35,7 @@
"properties": {
"templateId": { "kind": "path", "displayName": "Template Id", "group":
"common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The Route Template ID" },
"routeId": { "kind": "path", "displayName": "Route Id", "group": "common",
"label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The Route ID. Default value notice: The
ID will be auto-generated if not provided" },
+ "location": { "kind": "parameter", "displayName": "Location", "group":
"common", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Location of the Kamelet to use which can be specified as a
resource from file system, classpath etc. The location cannot use wildcards,
and must refer to a file including extension, for example
file:\/etc\/foo-kamelet.xml" },
"bridgeErrorHandler": { "kind": "parameter", "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 occurred
while the consumer is trying to pickup incoming messages, or the likes, will
now be processed as a m [...]
"exceptionHandler": { "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
con [...]
"exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false,
"description": "Sets the exchange pattern when the consumer creates an
exchange." },
diff --git a/components/camel-kamelet/src/main/docs/kamelet-component.adoc
b/components/camel-kamelet/src/main/docs/kamelet-component.adoc
index 07c8d02..69a3580 100644
--- a/components/camel-kamelet/src/main/docs/kamelet-component.adoc
+++ b/components/camel-kamelet/src/main/docs/kamelet-component.adoc
@@ -69,12 +69,13 @@ with the following path and query parameters:
|===
-=== Query Parameters (7 parameters):
+=== Query Parameters (8 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
+| *location* (common) | Location of the Kamelet to use which can be specified
as a resource from file system, classpath etc. The location cannot use
wildcards, and must refer to a file including extension, for example
file:/etc/foo-kamelet.xml | | String
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. 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
| *exceptionHandler* (consumer) | 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. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer
creates an exchange. There are 3 enums and the value can be one of: InOnly,
InOut, InOptionalOut | | ExchangePattern
diff --git
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
index 18aa658..e54c6db 100644
---
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
+++
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
@@ -42,6 +42,7 @@ public final class Kamelet {
public static final String SINK_ID = "sink";
public static final String PARAM_ROUTE_ID = "routeId";
public static final String PARAM_TEMPLATE_ID = "templateId";
+ public static final String PARAM_LOCATION = "location";
public static final String DEFAULT_LOCATION = "classpath:/kamelets";
// use a running counter as uuid
@@ -96,6 +97,14 @@ public final class Kamelet {
return answer;
}
+ public static String extractLocation(CamelContext context, Map<String,
Object> parameters) {
+ Object param = parameters.get(PARAM_LOCATION);
+ if (param != null) {
+ return CamelContextHelper.mandatoryConvertTo(context,
String.class, param);
+ }
+ return null;
+ }
+
public static void extractKameletProperties(CamelContext context,
Map<String, Object> properties, String... elements) {
PropertiesComponent pc = context.getPropertiesComponent();
String prefix = Kamelet.PROPERTIES_PREFIX;
diff --git
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
index fbab680..d5c67f1 100644
---
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
+++
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
@@ -39,10 +39,12 @@ import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;
import org.apache.camel.support.LifecycleStrategySupport;
import org.apache.camel.support.service.ServiceHelper;
+import org.apache.camel.util.FileUtil;
import org.apache.camel.util.StopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.camel.component.kamelet.Kamelet.PARAM_LOCATION;
import static org.apache.camel.component.kamelet.Kamelet.PARAM_ROUTE_ID;
import static org.apache.camel.component.kamelet.Kamelet.PARAM_TEMPLATE_ID;
@@ -100,9 +102,11 @@ public class KameletComponent extends DefaultComponent {
protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
final String templateId = Kamelet.extractTemplateId(getCamelContext(),
remaining, parameters);
final String routeId = Kamelet.extractRouteId(getCamelContext(),
remaining, parameters);
+ final String loc = Kamelet.extractLocation(getCamelContext(),
parameters);
parameters.remove(PARAM_TEMPLATE_ID);
parameters.remove(PARAM_ROUTE_ID);
+ parameters.remove(PARAM_LOCATION);
final KameletEndpoint endpoint;
@@ -132,6 +136,8 @@ public class KameletComponent extends DefaultComponent {
// forward component properties
endpoint.setBlock(block);
endpoint.setTimeout(timeout);
+ // endpoint specific location
+ endpoint.setLocation(loc);
// set endpoint specific properties
setProperties(endpoint, parameters);
@@ -151,6 +157,8 @@ public class KameletComponent extends DefaultComponent {
// forward component properties
endpoint.setBlock(block);
endpoint.setTimeout(timeout);
+ // endpoint specific location
+ endpoint.setLocation(loc);
// set and remove endpoint specific properties
setProperties(endpoint, parameters);
@@ -382,17 +390,27 @@ public class KameletComponent extends DefaultComponent {
final ModelCamelContext context =
getCamelContext().adapt(ModelCamelContext.class);
final String templateId = endpoint.getTemplateId();
final String routeId = endpoint.getRouteId();
+ final String loc = endpoint.getLocation() != null ?
endpoint.getLocation() : getLocation();
- if (context.getRouteTemplateDefinition(templateId) == null &&
getLocation() != null) {
- LOGGER.debug("Loading route template={} from {}", templateId,
getLocation());
+ if (context.getRouteTemplateDefinition(templateId) == null && loc
!= null) {
+ LOGGER.debug("Loading route template={} from {}", templateId,
loc);
boolean found = false;
- for (String path : getLocation().split(",")) {
- if (!path.endsWith("/")) {
- path += "/";
+ for (String path : loc.split(",")) {
+ String name = path;
+ Resource res = null;
+ // first try resource as-is if the path has an extension
+ String ext = FileUtil.onlyExt(path);
+ if (ext != null) {
+ res = ecc.getResourceLoader().resolveResource(name);
+ }
+ if (res == null || !res.exists()) {
+ if (!path.endsWith("/")) {
+ path += "/";
+ }
+ name = path + templateId + ".kamelet.yaml";
+ res = ecc.getResourceLoader().resolveResource(name);
}
- String name = path + templateId + ".kamelet.yaml";
- Resource res =
ecc.getResourceLoader().resolveResource(name);
if (res.exists()) {
try {
if (kameletResourceLoaderListener != null) {
@@ -410,16 +428,16 @@ public class KameletComponent extends DefaultComponent {
}
if (!found) {
// fallback to old behaviour
- String path = getLocation();
+ String path = loc;
if (!path.endsWith("/")) {
path += "/";
}
- String loc = path + templateId + ".kamelet.yaml";
+ String target = path + templateId + ".kamelet.yaml";
try {
ecc.getRoutesLoader().loadRoutes(
- ecc.getResourceLoader().resolveResource(loc));
+
ecc.getResourceLoader().resolveResource(target));
} catch (Exception e) {
- throw new KameletNotFoundException(templateId, loc, e);
+ throw new KameletNotFoundException(templateId, target,
e);
}
}
}
diff --git
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletEndpoint.java
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletEndpoint.java
index 9c97e9e..59e1d90 100644
---
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletEndpoint.java
+++
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletEndpoint.java
@@ -43,6 +43,9 @@ public class KameletEndpoint extends DefaultEndpoint {
@Metadata
@UriPath(description = "The Route ID", defaultValueNote = "The ID will be
auto-generated if not provided")
private final String routeId;
+ @UriParam(description = "Location of the Kamelet to use which can be
specified as a resource from file system, classpath etc."
+ + " The location cannot use wildcards, and must
refer to a file including extension, for example file:/etc/foo-kamelet.xml")
+ private String location;
@UriParam(label = "producer", defaultValue = "true")
private boolean block = true;
@@ -127,6 +130,14 @@ public class KameletEndpoint extends DefaultEndpoint {
return routeId;
}
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
public Map<String, Object> getKameletProperties() {
return Collections.unmodifiableMap(kameletProperties);
}
diff --git
a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletLocationTest.java
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletLocationTest.java
new file mode 100644
index 0000000..a1101a7
--- /dev/null
+++
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletLocationTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.kamelet;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.http.annotation.Obsolete;
+import org.junit.jupiter.api.Test;
+
+public class KameletLocationTest extends CamelTestSupport {
+
+ @Test
+ public void testOne() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("HELLO");
+
+ template.sendBody("direct:start", "Hello");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("HELLO",
"WORLD");
+
+ template.sendBody("direct:start", "Hello");
+ template.sendBody("direct:start", "World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Obsolete
+ protected RoutesBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+
.kamelet("upper?location=file:src/test/resources/upper-kamelet.xml")
+ .to("mock:result");
+ }
+ };
+ }
+}
diff --git a/components/camel-kamelet/src/test/resources/upper-kamelet.xml
b/components/camel-kamelet/src/test/resources/upper-kamelet.xml
new file mode 100644
index 0000000..a079298
--- /dev/null
+++ b/components/camel-kamelet/src/test/resources/upper-kamelet.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<routeTemplate id="upper">
+ <route>
+ <from uri="kamelet:source"/>
+ <transform>
+ <simple>${body.toUpperCase()}</simple>
+ </transform>
+ </route>
+</routeTemplate>
\ No newline at end of file
diff --git
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java
index d07b2da..e2c13e8 100644
---
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java
+++
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java
@@ -42,6 +42,23 @@ public interface KameletEndpointBuilderFactory {
return (AdvancedKameletEndpointConsumerBuilder) this;
}
/**
+ * Location of the Kamelet to use which can be specified as a resource
+ * from file system, classpath etc. The location cannot use wildcards,
+ * and must refer to a file including extension, for example
+ * file:/etc/foo-kamelet.xml.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: common
+ *
+ * @param location the value to set
+ * @return the dsl builder
+ */
+ default KameletEndpointConsumerBuilder location(String location) {
+ doSetProperty("location", location);
+ return this;
+ }
+ /**
* Allows for bridging the consumer to the Camel routing Error Handler,
* which mean any exceptions occurred while the consumer is trying to
* pickup incoming messages, or the likes, will now be processed as a
@@ -179,6 +196,23 @@ public interface KameletEndpointBuilderFactory {
return (AdvancedKameletEndpointProducerBuilder) this;
}
/**
+ * Location of the Kamelet to use which can be specified as a resource
+ * from file system, classpath etc. The location cannot use wildcards,
+ * and must refer to a file including extension, for example
+ * file:/etc/foo-kamelet.xml.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: common
+ *
+ * @param location the value to set
+ * @return the dsl builder
+ */
+ default KameletEndpointProducerBuilder location(String location) {
+ doSetProperty("location", location);
+ return this;
+ }
+ /**
* If sending a message to a direct endpoint which has no active
* consumer, then we can tell the producer to block and wait for the
* consumer to become active.
@@ -350,6 +384,23 @@ public interface KameletEndpointBuilderFactory {
default AdvancedKameletEndpointBuilder advanced() {
return (AdvancedKameletEndpointBuilder) this;
}
+ /**
+ * Location of the Kamelet to use which can be specified as a resource
+ * from file system, classpath etc. The location cannot use wildcards,
+ * and must refer to a file including extension, for example
+ * file:/etc/foo-kamelet.xml.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: common
+ *
+ * @param location the value to set
+ * @return the dsl builder
+ */
+ default KameletEndpointBuilder location(String location) {
+ doSetProperty("location", location);
+ return this;
+ }
}
/**
diff --git a/docs/components/modules/ROOT/pages/kamelet-component.adoc
b/docs/components/modules/ROOT/pages/kamelet-component.adoc
index 982b910..3ed6c39 100644
--- a/docs/components/modules/ROOT/pages/kamelet-component.adoc
+++ b/docs/components/modules/ROOT/pages/kamelet-component.adoc
@@ -71,12 +71,13 @@ with the following path and query parameters:
|===
-=== Query Parameters (7 parameters):
+=== Query Parameters (8 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
+| *location* (common) | Location of the Kamelet to use which can be specified
as a resource from file system, classpath etc. The location cannot use
wildcards, and must refer to a file including extension, for example
file:/etc/foo-kamelet.xml | | String
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. 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
| *exceptionHandler* (consumer) | 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. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer
creates an exchange. There are 3 enums and the value can be one of: InOnly,
InOut, InOptionalOut | | ExchangePattern