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 2015/11/13 16:08:38 UTC
[3/4] camel git commit: CAMEL-8302: Added skipQueueDeclare flag to
camel-rabbitmq
CAMEL-8302: Added skipQueueDeclare flag to camel-rabbitmq
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/73584d28
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/73584d28
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/73584d28
Branch: refs/heads/camel-2.16.x
Commit: 73584d289a6d6ee62cf60053512a0c534d9c6832
Parents: e6a6ef8
Author: davidwilliams <da...@getgathering.com>
Authored: Wed Nov 11 14:11:36 2015 -0500
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Nov 13 16:12:02 2015 +0100
----------------------------------------------------------------------
.../camel/component/rabbitmq/RabbitMQEndpoint.java | 16 +++++++++++++++-
.../component/rabbitmq/RabbitMQEndpointTest.java | 6 ++++++
2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/73584d28/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 50aebd2..ff57d7b 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,8 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
private String exchangeType = "direct";
@UriParam
private String routingKey;
+ @UriParam(defaultValue = "false")
+ private boolean skipQueueDeclare = false;
@UriParam
private Address[] addresses;
@UriParam(defaultValue = "" + ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT)
@@ -369,7 +371,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
getExchangeType(),
isDurable(),
isAutoDelete(), exchangeArgs);
- if (getQueue() != null) {
+ if (!isSkipQueueDeclare() && getQueue() != null) {
// need to make sure the queueDeclare is same with the exchange declare
channel.queueDeclare(getQueue(), isDurable(), false,
isAutoDelete(), queueArgs);
@@ -588,6 +590,18 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
}
/**
+ * If true the producer will not declare and bind a queue.
+ * This can be used for directing messages via an existing routing key.
+ */
+ public void setSkipQueueDeclare(boolean skipQueueDeclare) {
+ this.skipQueueDeclare = skipQueueDeclare;
+ }
+
+ public boolean isSkipQueueDeclare() {
+ return skipQueueDeclare;
+ }
+
+ /**
* If the bridgeEndpoint is true, the producer will ignore the message header of "rabbitmq.EXCHANGE_NAME" and "rabbitmq.ROUTING_KEY"
*/
public void setBridgeEndpoint(boolean bridgeEndpoint) {
http://git-wip-us.apache.org/repos/asf/camel/blob/73584d28/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
index ad9aca8..a3290c9 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
@@ -248,4 +248,10 @@ public class RabbitMQEndpointTest extends CamelTestSupport {
RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?requestTimeoutCheckerInterval=1000", RabbitMQEndpoint.class);
assertEquals(1000, endpoint.getRequestTimeoutCheckerInterval());
}
+
+ @Test
+ public void createEndpointWithSkipQueueDeclareEnabled() throws Exception {
+ RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?skipQueueDeclare=true", RabbitMQEndpoint.class);
+ assertTrue(endpoint.isSkipQueueDeclare());
+ }
}