camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: CAMEL-7421: Allow to configure the options from the endpoint which is standard way in Camel.
Date Thu, 04 Dec 2014 06:43:58 GMT
CAMEL-7421: Allow to configure the options from the endpoint which is standard way in Camel.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a8dfb035
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a8dfb035
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a8dfb035

Branch: refs/heads/master
Commit: a8dfb03590029365418341a249627e4049acae9c
Parents: 00e93fc
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Dec 4 07:43:43 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Dec 4 07:43:43 2014 +0100

----------------------------------------------------------------------
 .../component/rabbitmq/RabbitMQEndpoint.java    | 40 ++++++++++++++++
 .../component/rabbitmq/RabbitMQProducer.java    | 48 ++------------------
 .../features/src/main/resources/features.xml    |  1 +
 3 files changed, 44 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a8dfb035/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
index 645a572..f36fd82 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
@@ -95,6 +95,10 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
     private String deadLetterQueue;
     //Dead letter exchange type.
     private String deadLetterExchangeType = "direct";
+    //Maximum number of opened channel in pool
+    private int channelPoolMaxSize = 10;
+    //Maximum time (in milliseconds) waiting for channel
+    private long channelPoolMaxWait = 1000;
 
     public RabbitMQEndpoint() {
     }
@@ -539,4 +543,40 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
     public void setDeadLetterExchangeType(String deadLetterExchangeType) {
         this.deadLetterExchangeType = deadLetterExchangeType;
     }
+
+    /**
+     * Get maximum number of opened channel in pool
+     *
+     * @return Maximum number of opened channel in pool
+     */
+    public int getChannelPoolMaxSize() {
+        return channelPoolMaxSize;
+    }
+
+    /**
+     * Set maximum number of opened channel in pool
+     *
+     * @param channelPoolMaxSize Maximum number of opened channel in pool
+     */
+    public void setChannelPoolMaxSize(int channelPoolMaxSize) {
+        this.channelPoolMaxSize = channelPoolMaxSize;
+    }
+
+    /**
+     * Get the maximum number of milliseconds to wait for a channel from the pool
+     *
+     * @return Maximum number of milliseconds waiting for a channel
+     */
+    public long getChannelPoolMaxWait() {
+        return channelPoolMaxWait;
+    }
+
+    /**
+     * Set the maximum number of milliseconds to wait for a channel from the pool
+     *
+     * @param channelPoolMaxWait Maximum number of milliseconds waiting for a channel
+     */
+    public void setChannelPoolMaxWait(long channelPoolMaxWait) {
+        this.channelPoolMaxWait = channelPoolMaxWait;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a8dfb035/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQProducer.java
b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQProducer.java
index 54562d5..96bd516 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQProducer.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQProducer.java
@@ -35,18 +35,10 @@ import org.apache.commons.pool.impl.GenericObjectPool;
 
 public class RabbitMQProducer extends DefaultProducer {
 
-    private int closeTimeout = 30 * 1000;
     private Connection conn;
-    /**
-     * Maximum number of opened channel in pool
-     */
-    private int channelPoolMaxSize = 10;
-    /**
-     * Maximum time (in milliseconds) waiting for channel
-     */
-    private long channelPoolMaxWait = 1000;
     private ObjectPool<Channel> channelPool;
     private ExecutorService executorService;
+    private int closeTimeout = 30 * 1000;
 
     public RabbitMQProducer(RabbitMQEndpoint endpoint) throws IOException {
         super(endpoint);
@@ -85,7 +77,8 @@ public class RabbitMQProducer extends DefaultProducer {
         log.debug("Created connection: {}", conn);
 
         log.trace("Creating channel pool...");
-        channelPool = new GenericObjectPool<Channel>(new PoolableChannelFactory(this.conn),
getChannelPoolMaxSize(), GenericObjectPool.WHEN_EXHAUSTED_BLOCK, getChannelPoolMaxWait());
+        channelPool = new GenericObjectPool<Channel>(new PoolableChannelFactory(this.conn),
getEndpoint().getChannelPoolMaxSize(),
+                GenericObjectPool.WHEN_EXHAUSTED_BLOCK, getEndpoint().getChannelPoolMaxWait());
         if (getEndpoint().isDeclare()) {
             execute(new ChannelCallback<Void>() {
                 @Override
@@ -297,39 +290,4 @@ public class RabbitMQProducer extends DefaultProducer {
         this.closeTimeout = closeTimeout;
     }
 
-    /**
-     * Get maximum number of opened channel in pool
-     *
-     * @return Maximum number of opened channel in pool
-     */
-    public int getChannelPoolMaxSize() {
-        return channelPoolMaxSize;
-    }
-
-    /**
-     * Set maximum number of opened channel in pool
-     *
-     * @param channelPoolMaxSize Maximum number of opened channel in pool
-     */
-    public void setChannelPoolMaxSize(int channelPoolMaxSize) {
-        this.channelPoolMaxSize = channelPoolMaxSize;
-    }
-
-    /**
-     * Get the maximum number of milliseconds to wait for a channel from the pool
-     *
-     * @return Maximum number of milliseconds waiting for a channel
-     */
-    public long getChannelPoolMaxWait() {
-        return channelPoolMaxWait;
-    }
-
-    /**
-     * Set the maximum number of milliseconds to wait for a channel from the pool
-     *
-     * @param channelPoolMaxWait Maximum number of milliseconds waiting for a channel
-     */
-    public void setChannelPoolMaxWait(long channelPoolMaxWait) {
-        this.channelPoolMaxWait = channelPoolMaxWait;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a8dfb035/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index d335618..51505f8 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1069,6 +1069,7 @@
   <feature name='camel-rabbitmq' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <bundle dependency='true'>mvn:com.rabbitmq/amqp-client/${rabbitmq-amqp-client-version}</bundle>
+    <bundle dependency='true'>mvn:commons-pool/commons-pool/${commons-pool-version}</bundle>
   
     <bundle>mvn:org.apache.camel/camel-rabbitmq/${project.version}</bundle>
   </feature>
   <feature name='camel-restlet' version='${project.version}' resolver='(obr)' start-level='50'>


Mime
View raw message