CAMEL-8544 Dynamic router - unsupported cacheSize attribute
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/38beadc1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/38beadc1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/38beadc1 Branch: refs/heads/camel-2.15.x Commit: 38beadc19518f058fab2aa68a6cbc3fbd1473234 Parents: 368d78f Author: Willem Jiang <willem.ji...@gmail.com> Authored: Wed Mar 25 11:38:06 2015 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Wed Mar 25 11:43:38 2015 +0800 ---------------------------------------------------------------------- .../camel/model/DynamicRouterDefinition.java | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/38beadc1/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java b/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java index cf5899d..9d39830 100644 --- a/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java @@ -44,6 +44,8 @@ public class DynamicRouterDefinition<Type extends ProcessorDefinition<Type>> ext private String uriDelimiter; @XmlAttribute private Boolean ignoreInvalidEndpoints; + @XmlAttribute + private Integer cacheSize; public DynamicRouterDefinition() { } @@ -76,6 +78,9 @@ public class DynamicRouterDefinition<Type extends ProcessorDefinition<Type>> ext if (getIgnoreInvalidEndpoints() != null) { dynamicRouter.setIgnoreInvalidEndpoints(getIgnoreInvalidEndpoints()); } + if (getCacheSize() != null) { + dynamicRouter.setCacheSize(getCacheSize()); + } return dynamicRouter; } @@ -110,6 +115,14 @@ public class DynamicRouterDefinition<Type extends ProcessorDefinition<Type>> ext // Fluent API // ------------------------------------------------------------------------- + public Integer getCacheSize() { + return cacheSize; + } + + public void setCacheSize(Integer cacheSize) { + this.cacheSize = cacheSize; + } + @Override @SuppressWarnings("unchecked") public Type end() { @@ -137,5 +150,17 @@ public class DynamicRouterDefinition<Type extends ProcessorDefinition<Type>> ext setUriDelimiter(uriDelimiter); return this; } + + /** + * Sets the maximum size used by the {@link org.apache.camel.impl.ProducerCache} which is used + * to cache and reuse producers when using this recipient list, when uris are reused. + * + * @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(int cacheSize) { + setCacheSize(cacheSize); + return this; + } }