Repository: camel
Updated Branches:
  refs/heads/master 9f0e167b8 -> e83d342f6


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/e83d342f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e83d342f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e83d342f

Branch: refs/heads/master
Commit: e83d342f6aaf49668aec5234e7cdadbe311e41ab
Parents: 9f0e167
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:40:38 2015 +0800

----------------------------------------------------------------------
 .../camel/model/DynamicRouterDefinition.java    | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e83d342f/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;
+    }
 
 }

Reply via email to