You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/02/21 12:04:34 UTC

[camel] 05/11: CAMEL-14596: Update cache size documentation

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8cea4e7503f783b1142f99024977598e9f9b8be5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 21 10:42:50 2020 +0100

    CAMEL-14596: Update cache size documentation
---
 .../org/apache/camel/model/dynamicRouter.json      |  2 +-
 .../resources/org/apache/camel/model/enrich.json   |  2 +-
 .../org/apache/camel/model/pollEnrich.json         |  2 +-
 .../org/apache/camel/model/recipientList.json      |  2 +-
 .../org/apache/camel/model/routingSlip.json        |  2 +-
 .../camel/model/DynamicRouterDefinition.java       | 40 ++++++++++++++++++++++
 .../org/apache/camel/model/EnrichDefinition.java   | 40 ++++++++++++++++++++++
 .../apache/camel/model/PollEnrichDefinition.java   | 40 ++++++++++++++++++++++
 .../camel/model/RecipientListDefinition.java       | 40 ++++++++++++++++++++++
 .../apache/camel/model/RoutingSlipDefinition.java  | 26 ++++++++++++++
 .../org/apache/camel/model/WireTapDefinition.java  | 26 ++++++++++++++
 11 files changed, 217 insertions(+), 5 deletions(-)

diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dynamicRouter.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dynamicRouter.json
index be30ae6..75eaf43 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dynamicRouter.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dynamicRouter.json
@@ -14,7 +14,7 @@
     "expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "exchangeProperty", "groovy", "header", "hl7terser", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "secret": false, "description": "Expression to call that returns the endpoint(s) to route to in the [...]
     "uriDelimiter": { "kind": "attribute", "displayName": "Uri Delimiter", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": ",", "description": "Sets the uri delimiter to use" },
     "ignoreInvalidEndpoints": { "kind": "attribute", "displayName": "Ignore Invalid Endpoints", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Ignore the invalidate endpoint exception when try to create a producer with that endpoint" },
-    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this dynamic router, when uris are reused." },
+    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this dynamic router, when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then i [...]
     "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the id of this node" },
     "description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "secret": false, "description": "Sets the description of this node" }
   }
diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/enrich.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/enrich.json
index 70eaf77..d199764 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/enrich.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/enrich.json
@@ -17,7 +17,7 @@
     "strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy." },
     "aggregateOnException": { "kind": "attribute", "displayName": "Aggregate On Exception", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if there was an exception in the aggregate method. F [...]
     "shareUnitOfWork": { "kind": "attribute", "displayName": "Share Unit Of Work", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Shares the org.apache.camel.spi.UnitOfWork with the parent and the resource exchange. Enrich will by default not share unit of work between the parent exchange and the resource exchange. This means the resource exchange has its own individual unit of work." },
-    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producer when uris are reused." },
+    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producer when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then its best to turn of caching by set [...]
     "ignoreInvalidEndpoint": { "kind": "attribute", "displayName": "Ignore Invalid Endpoint", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Ignore the invalidate endpoint exception when try to create a producer with that endpoint" },
     "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the id of this node" },
     "description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "secret": false, "description": "Sets the description of this node" }
diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/pollEnrich.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/pollEnrich.json
index 62a03a8..77d8d01 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/pollEnrich.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/pollEnrich.json
@@ -17,7 +17,7 @@
     "strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
     "strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy." },
     "aggregateOnException": { "kind": "attribute", "displayName": "Aggregate On Exception", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if there was an exception in the aggregate method. F [...]
-    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ConsumerCache which is used to cache and reuse consumers when uris are reused." },
+    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ConsumerCache which is used to cache and reuse consumers when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then its best to turn of caching by se [...]
     "ignoreInvalidEndpoint": { "kind": "attribute", "displayName": "Ignore Invalid Endpoint", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Ignore the invalidate endpoint exception when try to create a producer with that endpoint" },
     "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the id of this node" },
     "description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "secret": false, "description": "Sets the description of this node" }
diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/recipientList.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/recipientList.json
index d9c0950..f943560 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/recipientList.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/recipientList.json
@@ -24,7 +24,7 @@
     "timeout": { "kind": "attribute", "displayName": "Timeout", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "0", "description": "Sets a total timeout specified in millis, when using parallel processing. If the Recipient List hasn't been able to send and process all replies within the given timeframe, then the timeout triggers and the Recipient List breaks out and continues. Notice if you provide a TimeoutAware [...]
     "onPrepareRef": { "kind": "attribute", "displayName": "On Prepare Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Uses the Processor when preparing the org.apache.camel.Exchange to be send. This can be used to deep-clone messages that should be send, or any custom logic needed before the exchange is send." },
     "shareUnitOfWork": { "kind": "attribute", "displayName": "Share Unit Of Work", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Shares the org.apache.camel.spi.UnitOfWork with the parent and each of the sub messages. Recipient List will by default not share unit of work between the parent exchange and each recipient exchange. This means each sub exchange has its own individual unit of work." },
-    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this recipient list, when uris are reused." },
+    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this recipient list, when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then i [...]
     "parallelAggregate": { "kind": "attribute", "displayName": "Parallel Aggregate", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "If enabled then the aggregate method on AggregationStrategy can be called concurrently. Notice that this would require the implementation of AggregationStrategy to be implemented as thread-safe. By default this is false meaning that Camel synchronizes the call to the aggregate method [...]
     "stopOnAggregateException": { "kind": "attribute", "displayName": "Stop On Aggregate Exception", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "If enabled, unwind exceptions occurring at aggregation time to the error handler when parallelProcessing is used. Currently, aggregation time exceptions do not stop the route processing when parallelProcessing is used. Enabling this option allows to work around this b [...]
     "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the id of this node" },
diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/routingSlip.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/routingSlip.json
index ba01f3b..d0b3fac 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/routingSlip.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/routingSlip.json
@@ -14,7 +14,7 @@
     "expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "exchangeProperty", "groovy", "header", "hl7terser", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "secret": false, "description": "Expression to define the routing slip, which defines which endpoin [...]
     "uriDelimiter": { "kind": "attribute", "displayName": "Uri Delimiter", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": ",", "description": "Sets the uri delimiter to use" },
     "ignoreInvalidEndpoints": { "kind": "attribute", "displayName": "Ignore Invalid Endpoints", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Ignore the invalidate endpoint exception when try to create a producer with that endpoint" },
-    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this routing slip, when uris are reused." },
+    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this routing slip, when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then i [...]
     "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the id of this node" },
     "description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "secret": false, "description": "Sets the description of this node" }
   }
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java
index cef0095..620595c 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java
@@ -148,6 +148,19 @@ public class DynamicRouterDefinition<Type extends ProcessorDefinition<Type>> ext
      * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
      * reuse producers when using this dynamic router, when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder
@@ -157,4 +170,31 @@ public class DynamicRouterDefinition<Type extends ProcessorDefinition<Type>> ext
         return this;
     }
 
+    /**
+     * Sets the maximum size used by the
+     * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
+     * reuse producers when using this dynamic router, when uris are reused.
+     *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
+     * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
+     *            or <tt>-1</tt> to turn cache off.
+     * @return the builder
+     */
+    public DynamicRouterDefinition<Type> cacheSize(String cacheSize) {
+        setCacheSize(cacheSize);
+        return this;
+    }
+
 }
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/EnrichDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/EnrichDefinition.java
index 13ad4ad..7210bc2 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/EnrichDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/EnrichDefinition.java
@@ -158,6 +158,19 @@ public class EnrichDefinition extends ExpressionNode {
      * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
      * reuse producer when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder
@@ -168,6 +181,33 @@ public class EnrichDefinition extends ExpressionNode {
     }
 
     /**
+     * Sets the maximum size used by the
+     * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
+     * reuse producer when uris are reused.
+     *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
+     * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
+     *            or <tt>-1</tt> to turn cache off.
+     * @return the builder
+     */
+    public EnrichDefinition cacheSize(String cacheSize) {
+        setCacheSize(cacheSize);
+        return this;
+    }
+
+    /**
      * Ignore the invalidate endpoint exception when try to create a producer
      * with that endpoint
      *
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/PollEnrichDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
index 8fdda8e..ea15e03 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
@@ -172,6 +172,19 @@ public class PollEnrichDefinition extends ExpressionNode {
      * {@link org.apache.camel.spi.ConsumerCache} which is used to cache and
      * reuse consumers when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder
@@ -182,6 +195,33 @@ public class PollEnrichDefinition extends ExpressionNode {
     }
 
     /**
+     * Sets the maximum size used by the
+     * {@link org.apache.camel.spi.ConsumerCache} which is used to cache and
+     * reuse consumers when uris are reused.
+     *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
+     * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
+     *            or <tt>-1</tt> to turn cache off.
+     * @return the builder
+     */
+    public PollEnrichDefinition cacheSize(String cacheSize) {
+        setCacheSize(cacheSize);
+        return this;
+    }
+
+    /**
      * Ignore the invalidate endpoint exception when try to create a producer
      * with that endpoint
      *
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java
index 098e6a0..a9a4076 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java
@@ -384,6 +384,19 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
      * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
      * reuse producers when using this recipient list, when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder
@@ -393,6 +406,33 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
         return this;
     }
 
+    /**
+     * Sets the maximum size used by the
+     * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
+     * reuse producers when using this recipient list, when uris are reused.
+     *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
+     * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
+     *            or <tt>-1</tt> to turn cache off.
+     * @return the builder
+     */
+    public RecipientListDefinition<Type> cacheSize(String cacheSize) {
+        setCacheSize(cacheSize);
+        return this;
+    }
+
     // Properties
     // -------------------------------------------------------------------------
 
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
index 55c149e..5992be8 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
@@ -183,6 +183,19 @@ public class RoutingSlipDefinition<Type extends ProcessorDefinition<Type>> exten
      * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
      * reuse producers when using this routing slip, when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder
@@ -196,6 +209,19 @@ public class RoutingSlipDefinition<Type extends ProcessorDefinition<Type>> exten
      * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
      * reuse producers when using this routing slip, when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java
index 9a80a65..6a21ad4 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java
@@ -282,6 +282,19 @@ public class WireTapDefinition<Type extends ProcessorDefinition<Type>> extends T
      * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
      * reuse producers, when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder
@@ -296,6 +309,19 @@ public class WireTapDefinition<Type extends ProcessorDefinition<Type>> extends T
      * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
      * reuse producers, when uris are reused.
      *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
+     *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
      * @return the builder