Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA119108EE for ; Thu, 4 Dec 2014 06:43:56 +0000 (UTC) Received: (qmail 16640 invoked by uid 500); 4 Dec 2014 06:43:56 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 16490 invoked by uid 500); 4 Dec 2014 06:43:56 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 16382 invoked by uid 99); 4 Dec 2014 06:43:56 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Dec 2014 06:43:56 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 6F11382BF74; Thu, 4 Dec 2014 06:43:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Thu, 04 Dec 2014 06:43:58 -0000 Message-Id: <4cbb16457c1b4bafa2d374bf97febff0@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/3] camel git commit: CAMEL-7421: Allow to configure the options from the endpoint which is standard way in Camel. 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 Authored: Thu Dec 4 07:43:43 2014 +0100 Committer: Claus Ibsen 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 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(new PoolableChannelFactory(this.conn), getChannelPoolMaxSize(), GenericObjectPool.WHEN_EXHAUSTED_BLOCK, getChannelPoolMaxWait()); + channelPool = new GenericObjectPool(new PoolableChannelFactory(this.conn), getEndpoint().getChannelPoolMaxSize(), + GenericObjectPool.WHEN_EXHAUSTED_BLOCK, getEndpoint().getChannelPoolMaxWait()); if (getEndpoint().isDeclare()) { execute(new ChannelCallback() { @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 @@ camel-core mvn:com.rabbitmq/amqp-client/${rabbitmq-amqp-client-version} + mvn:commons-pool/commons-pool/${commons-pool-version} mvn:org.apache.camel/camel-rabbitmq/${project.version}