This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch brow in repository https://gitbox.apache.org/repos/asf/camel.git
commit 544d655d0f1876f8b764e78eefd3d35a98905ffe Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Sep 7 17:48:54 2024 +0200 CAMEL-21183: BrowseEndpoint should have limit/filter to optimize returned data from component implementations --- .../apache/camel/catalog/components/browse.json | 10 +- .../component/browse/BrowseEndpointConfigurer.java | 14 ++ .../component/browse/BrowseEndpointUriFactory.java | 4 +- .../org/apache/camel/component/browse/browse.json | 10 +- .../camel/component/browse/BrowseEndpoint.java | 40 ++++- .../org/apache/camel/spi/BrowsableEndpoint.java | 21 +++ .../camel/impl/console/BrowseDevConsole.java | 18 +- .../endpoint/dsl/BrowseEndpointBuilderFactory.java | 186 +++++++++++++++++++++ .../apache/camel/kotlin/components/BrowseUriDsl.kt | 23 +++ 9 files changed, 301 insertions(+), 25 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/browse.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/browse.json index cf051c46d3e..282e00b28a2 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/browse.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/browse.json @@ -29,9 +29,11 @@ }, "properties": { "name": { "index": 0, "kind": "path", "displayName": "Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A name which can be any string to uniquely identify the endpoint" }, - "bridgeErrorHandler": { "index": 1, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] - "exceptionHandler": { "index": 2, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] - "exchangePattern": { "index": 3, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "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": 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 produc [...] + "limit": { "index": 1, "kind": "parameter", "displayName": "Limit", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "Maximum number of messages to keep in memory available for browsing. Use 0 for unlimited." }, + "bridgeErrorHandler": { "index": 2, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] + "exceptionHandler": { "index": 3, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] + "exchangePattern": { "index": 4, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "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": 5, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...] + "filter": { "index": 6, "kind": "parameter", "displayName": "Filter", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.function.Predicate<org.apache.camel.Exchange>", "deprecated": false, "autowired": false, "secret": false, "description": "To use a predicate to filter whether to include the message for browsing. Return true to include, false to exclude." } } } diff --git a/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointConfigurer.java b/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointConfigurer.java index d59dcce15a4..41b096fb488 100644 --- a/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointConfigurer.java +++ b/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointConfigurer.java @@ -29,8 +29,10 @@ public class BrowseEndpointConfigurer extends PropertyConfigurerSupport implemen case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true; case "exchangepattern": case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true; + case "filter": target.setFilter(property(camelContext, java.util.function.Predicate.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; + case "limit": target.setLimit(property(camelContext, int.class, value)); return true; default: return false; } } @@ -44,8 +46,10 @@ public class BrowseEndpointConfigurer extends PropertyConfigurerSupport implemen case "exceptionHandler": return org.apache.camel.spi.ExceptionHandler.class; case "exchangepattern": case "exchangePattern": return org.apache.camel.ExchangePattern.class; + case "filter": return java.util.function.Predicate.class; case "lazystartproducer": case "lazyStartProducer": return boolean.class; + case "limit": return int.class; default: return null; } } @@ -60,8 +64,18 @@ public class BrowseEndpointConfigurer extends PropertyConfigurerSupport implemen case "exceptionHandler": return target.getExceptionHandler(); case "exchangepattern": case "exchangePattern": return target.getExchangePattern(); + case "filter": return target.getFilter(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); + case "limit": return target.getLimit(); + default: return null; + } + } + + @Override + public Object getCollectionValueType(Object target, String name, boolean ignoreCase) { + switch (ignoreCase ? name.toLowerCase() : name) { + case "filter": return org.apache.camel.Exchange.class; default: return null; } } diff --git a/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointUriFactory.java b/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointUriFactory.java index 67a3115f5f4..ba3f172a426 100644 --- a/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointUriFactory.java +++ b/components/camel-browse/src/generated/java/org/apache/camel/component/browse/BrowseEndpointUriFactory.java @@ -23,11 +23,13 @@ public class BrowseEndpointUriFactory extends org.apache.camel.support.component private static final Set<String> SECRET_PROPERTY_NAMES; private static final Set<String> MULTI_VALUE_PREFIXES; static { - Set<String> props = new HashSet<>(5); + Set<String> props = new HashSet<>(7); props.add("bridgeErrorHandler"); props.add("exceptionHandler"); props.add("exchangePattern"); + props.add("filter"); props.add("lazyStartProducer"); + props.add("limit"); props.add("name"); PROPERTY_NAMES = Collections.unmodifiableSet(props); SECRET_PROPERTY_NAMES = Collections.emptySet(); diff --git a/components/camel-browse/src/generated/resources/META-INF/org/apache/camel/component/browse/browse.json b/components/camel-browse/src/generated/resources/META-INF/org/apache/camel/component/browse/browse.json index cf051c46d3e..282e00b28a2 100644 --- a/components/camel-browse/src/generated/resources/META-INF/org/apache/camel/component/browse/browse.json +++ b/components/camel-browse/src/generated/resources/META-INF/org/apache/camel/component/browse/browse.json @@ -29,9 +29,11 @@ }, "properties": { "name": { "index": 0, "kind": "path", "displayName": "Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A name which can be any string to uniquely identify the endpoint" }, - "bridgeErrorHandler": { "index": 1, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] - "exceptionHandler": { "index": 2, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] - "exchangePattern": { "index": 3, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "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": 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 produc [...] + "limit": { "index": 1, "kind": "parameter", "displayName": "Limit", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "Maximum number of messages to keep in memory available for browsing. Use 0 for unlimited." }, + "bridgeErrorHandler": { "index": 2, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] + "exceptionHandler": { "index": 3, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] + "exchangePattern": { "index": 4, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "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": 5, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...] + "filter": { "index": 6, "kind": "parameter", "displayName": "Filter", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.function.Predicate<org.apache.camel.Exchange>", "deprecated": false, "autowired": false, "secret": false, "description": "To use a predicate to filter whether to include the message for browsing. Return true to include, false to exclude." } } } diff --git a/components/camel-browse/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java b/components/camel-browse/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java index a19f0ce5d25..09f6c0342b6 100644 --- a/components/camel-browse/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java +++ b/components/camel-browse/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java @@ -18,6 +18,8 @@ package org.apache.camel.component.browse; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.function.Predicate; +import java.util.stream.Collectors; import org.apache.camel.Category; import org.apache.camel.Component; @@ -28,6 +30,7 @@ import org.apache.camel.Producer; import org.apache.camel.spi.BrowsableEndpoint; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; import org.apache.camel.support.DefaultConsumer; import org.apache.camel.support.DefaultEndpoint; @@ -46,6 +49,11 @@ public class BrowseEndpoint extends DefaultEndpoint implements BrowsableEndpoint @UriPath(description = "A name which can be any string to uniquely identify the endpoint") @Metadata(required = true) private String name; + @UriParam(description = "Maximum number of messages to keep in memory available for browsing. Use 0 for unlimited.") + private int limit; + @UriParam(label = "advanced", + description = "To use a predicate to filter whether to include the message for browsing. Return true to include, false to exclude.") + private Predicate<Exchange> filter; private List<Exchange> exchanges; private volatile Processor onExchangeProcessor; @@ -74,7 +82,13 @@ public class BrowseEndpoint extends DefaultEndpoint implements BrowsableEndpoint public Producer createProducer() throws Exception { return new DefaultProducer(this) { public void process(Exchange exchange) throws Exception { - onExchange(exchange); + boolean accept = true; + if (filter != null) { + accept = filter.test(exchange); + } + if (accept) { + onExchange(exchange); + } } }; } @@ -96,6 +110,22 @@ public class BrowseEndpoint extends DefaultEndpoint implements BrowsableEndpoint this.name = name; } + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public Predicate<Exchange> getFilter() { + return filter; + } + + public void setFilter(Predicate<Exchange> filter) { + this.filter = filter; + } + protected List<Exchange> createExchangeList() { return new CopyOnWriteArrayList<>(); } @@ -107,7 +137,13 @@ public class BrowseEndpoint extends DefaultEndpoint implements BrowsableEndpoint * @throws Exception is thrown if failed to process the exchange */ protected void onExchange(Exchange exchange) throws Exception { - getExchanges().add(exchange); + if (limit > 0) { + // make room if end of capacity + while (exchanges.size() >= (limit - 1)) { + exchanges.remove(0); + } + } + exchanges.add(exchange); // now fire the consumer if (onExchangeProcessor != null) { diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java b/core/camel-api/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java index 7c04abc1d26..b4296a40fde 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java @@ -17,6 +17,8 @@ package org.apache.camel.spi; import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; @@ -33,4 +35,23 @@ public interface BrowsableEndpoint extends Endpoint { * @return the exchanges on this endpoint */ List<Exchange> getExchanges(); + + /** + * Return the exchanges available on this endpoint, allowing to filter the + * result in the specific component. + * + * @param limit to limit the result o a specific maximum. Use 0 for no limit. + * @param filter filter to filter among the messages to include. + * @return the exchanges on this endpoint + */ + default List<Exchange> getExchanges(int limit, Predicate filter) { + List<Exchange> answer = getExchanges(); + if (filter != null) { + answer = (List<Exchange>) answer.stream().filter(filter).collect(Collectors.toList()); + } + if (limit > 0) { + answer = answer.stream().limit(limit).toList(); + } + return answer; + } } diff --git a/core/camel-console/src/main/java/org/apache/camel/impl/console/BrowseDevConsole.java b/core/camel-console/src/main/java/org/apache/camel/impl/console/BrowseDevConsole.java index 24c134561a3..f9443505338 100644 --- a/core/camel-console/src/main/java/org/apache/camel/impl/console/BrowseDevConsole.java +++ b/core/camel-console/src/main/java/org/apache/camel/impl/console/BrowseDevConsole.java @@ -85,15 +85,10 @@ public class BrowseDevConsole extends AbstractDevConsole { for (Endpoint endpoint : endpoints) { if (endpoint instanceof BrowsableEndpoint be && (filter == null || PatternHelper.matchPattern(endpoint.getEndpointUri(), filter))) { - List<Exchange> list = be.getExchanges(); - long size = list != null ? list.size() : 0; - if (list != null && list.size() > max) { - size = list.size(); - list = list.subList(0, max); - } + List<Exchange> list = be.getExchanges(max, null); if (list != null) { sb.append("\n"); - sb.append(String.format("Browse: %s (size: %d)%n", endpoint.getEndpointUri(), size)); + sb.append(String.format("Browse: %s (size: %d)%n", endpoint.getEndpointUri(), max)); if (dump) { for (Exchange e : list) { String json = MessageHelper.dumpAsJSon(e.getMessage(), false, false, true, 2, true, true, true, @@ -125,16 +120,11 @@ public class BrowseDevConsole extends AbstractDevConsole { for (Endpoint endpoint : endpoints) { if (endpoint instanceof BrowsableEndpoint be && (filter == null || PatternHelper.matchPattern(endpoint.getEndpointUri(), filter))) { - List<Exchange> list = be.getExchanges(); - long size = list != null ? list.size() : 0; - if (list != null && list.size() > max) { - size = list.size(); - list = list.subList(0, max); - } + List<Exchange> list = be.getExchanges(max, null); if (list != null) { JsonObject jo = new JsonObject(); jo.put("endpointUri", endpoint.getEndpointUri()); - jo.put("size", size); + jo.put("size", max); arr.add(jo); if (dump) { JsonArray arr2 = new JsonArray(); diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BrowseEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BrowseEndpointBuilderFactory.java index 1a695e898b1..e8c6efb8932 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BrowseEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BrowseEndpointBuilderFactory.java @@ -43,6 +43,36 @@ public interface BrowseEndpointBuilderFactory { default AdvancedBrowseEndpointConsumerBuilder advanced() { return (AdvancedBrowseEndpointConsumerBuilder) this; } + /** + * Maximum number of messages to keep in memory available for browsing. + * Use 0 for unlimited. + * + * The option is a: <code>int</code> type. + * + * Group: common + * + * @param limit the value to set + * @return the dsl builder + */ + default BrowseEndpointConsumerBuilder limit(int limit) { + doSetProperty("limit", limit); + return this; + } + /** + * Maximum number of messages to keep in memory available for browsing. + * Use 0 for unlimited. + * + * The option will be converted to a <code>int</code> type. + * + * Group: common + * + * @param limit the value to set + * @return the dsl builder + */ + default BrowseEndpointConsumerBuilder limit(String limit) { + doSetProperty("limit", limit); + return this; + } } /** @@ -171,6 +201,38 @@ public interface BrowseEndpointBuilderFactory { doSetProperty("exchangePattern", exchangePattern); return this; } + /** + * To use a predicate to filter whether to include the message for + * browsing. Return true to include, false to exclude. + * + * The option is a: + * <code>java.util.function.Predicate<org.apache.camel.Exchange></code> type. + * + * Group: advanced + * + * @param filter the value to set + * @return the dsl builder + */ + default AdvancedBrowseEndpointConsumerBuilder filter(Predicate<org.apache.camel.Exchange> filter) { + doSetProperty("filter", filter); + return this; + } + /** + * To use a predicate to filter whether to include the message for + * browsing. Return true to include, false to exclude. + * + * The option will be converted to a + * <code>java.util.function.Predicate<org.apache.camel.Exchange></code> type. + * + * Group: advanced + * + * @param filter the value to set + * @return the dsl builder + */ + default AdvancedBrowseEndpointConsumerBuilder filter(String filter) { + doSetProperty("filter", filter); + return this; + } } /** @@ -183,6 +245,36 @@ public interface BrowseEndpointBuilderFactory { return (AdvancedBrowseEndpointProducerBuilder) this; } + /** + * Maximum number of messages to keep in memory available for browsing. + * Use 0 for unlimited. + * + * The option is a: <code>int</code> type. + * + * Group: common + * + * @param limit the value to set + * @return the dsl builder + */ + default BrowseEndpointProducerBuilder limit(int limit) { + doSetProperty("limit", limit); + return this; + } + /** + * Maximum number of messages to keep in memory available for browsing. + * Use 0 for unlimited. + * + * The option will be converted to a <code>int</code> type. + * + * Group: common + * + * @param limit the value to set + * @return the dsl builder + */ + default BrowseEndpointProducerBuilder limit(String limit) { + doSetProperty("limit", limit); + return this; + } } /** @@ -239,6 +331,38 @@ public interface BrowseEndpointBuilderFactory { doSetProperty("lazyStartProducer", lazyStartProducer); return this; } + /** + * To use a predicate to filter whether to include the message for + * browsing. Return true to include, false to exclude. + * + * The option is a: + * <code>java.util.function.Predicate<org.apache.camel.Exchange></code> type. + * + * Group: advanced + * + * @param filter the value to set + * @return the dsl builder + */ + default AdvancedBrowseEndpointProducerBuilder filter(Predicate<org.apache.camel.Exchange> filter) { + doSetProperty("filter", filter); + return this; + } + /** + * To use a predicate to filter whether to include the message for + * browsing. Return true to include, false to exclude. + * + * The option will be converted to a + * <code>java.util.function.Predicate<org.apache.camel.Exchange></code> type. + * + * Group: advanced + * + * @param filter the value to set + * @return the dsl builder + */ + default AdvancedBrowseEndpointProducerBuilder filter(String filter) { + doSetProperty("filter", filter); + return this; + } } /** @@ -252,6 +376,36 @@ public interface BrowseEndpointBuilderFactory { return (AdvancedBrowseEndpointBuilder) this; } + /** + * Maximum number of messages to keep in memory available for browsing. + * Use 0 for unlimited. + * + * The option is a: <code>int</code> type. + * + * Group: common + * + * @param limit the value to set + * @return the dsl builder + */ + default BrowseEndpointBuilder limit(int limit) { + doSetProperty("limit", limit); + return this; + } + /** + * Maximum number of messages to keep in memory available for browsing. + * Use 0 for unlimited. + * + * The option will be converted to a <code>int</code> type. + * + * Group: common + * + * @param limit the value to set + * @return the dsl builder + */ + default BrowseEndpointBuilder limit(String limit) { + doSetProperty("limit", limit); + return this; + } } /** @@ -265,6 +419,38 @@ public interface BrowseEndpointBuilderFactory { return (BrowseEndpointBuilder) this; } + /** + * To use a predicate to filter whether to include the message for + * browsing. Return true to include, false to exclude. + * + * The option is a: + * <code>java.util.function.Predicate<org.apache.camel.Exchange></code> type. + * + * Group: advanced + * + * @param filter the value to set + * @return the dsl builder + */ + default AdvancedBrowseEndpointBuilder filter(Predicate<org.apache.camel.Exchange> filter) { + doSetProperty("filter", filter); + return this; + } + /** + * To use a predicate to filter whether to include the message for + * browsing. Return true to include, false to exclude. + * + * The option will be converted to a + * <code>java.util.function.Predicate<org.apache.camel.Exchange></code> type. + * + * Group: advanced + * + * @param filter the value to set + * @return the dsl builder + */ + default AdvancedBrowseEndpointBuilder filter(String filter) { + doSetProperty("filter", filter); + return this; + } } public interface BrowseBuilders { diff --git a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/BrowseUriDsl.kt b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/BrowseUriDsl.kt index 7a160e1d86d..3bde4f04866 100644 --- a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/BrowseUriDsl.kt +++ b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/BrowseUriDsl.kt @@ -17,6 +17,7 @@ package org.apache.camel.kotlin.components import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Unit import org.apache.camel.kotlin.CamelDslMarker @@ -50,6 +51,20 @@ public class BrowseUriDsl( it.url("$name") } + /** + * Maximum number of messages to keep in memory available for browsing. Use 0 for unlimited. + */ + public fun limit(limit: String) { + it.property("limit", limit) + } + + /** + * Maximum number of messages to keep in memory available for browsing. Use 0 for unlimited. + */ + public fun limit(limit: Int) { + it.property("limit", limit.toString()) + } + /** * Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions * (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the @@ -119,4 +134,12 @@ public class BrowseUriDsl( public fun lazyStartProducer(lazyStartProducer: Boolean) { it.property("lazyStartProducer", lazyStartProducer.toString()) } + + /** + * To use a predicate to filter whether to include the message for browsing. Return true to + * include, false to exclude. + */ + public fun filter(filter: String) { + it.property("filter", filter) + } }