camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [2/2] git commit: CAMEL-6809 Introduced BridgeEndpoint option to avoid the side effect of rabbitmq.EXCHANGE_NAME header
Date Tue, 26 Nov 2013 08:46:06 GMT
CAMEL-6809 Introduced BridgeEndpoint option to avoid the side effect of rabbitmq.EXCHANGE_NAME
header


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

Branch: refs/heads/master
Commit: a193ea9cf2833cacf687191ac312e5fe29301e08
Parents: 8a74fc9
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Tue Nov 26 16:45:07 2013 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Tue Nov 26 16:45:07 2013 +0800

----------------------------------------------------------------------
 .../apache/camel/component/rabbitmq/RabbitMQEndpoint.java   | 9 +++++++++
 .../apache/camel/component/rabbitmq/RabbitMQProducer.java   | 5 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a193ea9c/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 b008646..f54f41f 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
@@ -49,6 +49,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
     private boolean autoAck = true;
     private boolean autoDelete = true;
     private boolean durable = true;
+    private boolean bridgeEndpoint;
     private String queue = String.valueOf(UUID.randomUUID().toString().hashCode());
     private String exchangeName;
     private String exchangeType = "direct";
@@ -230,4 +231,12 @@ public class RabbitMQEndpoint extends DefaultEndpoint {
     public void setRoutingKey(String routingKey) {
         this.routingKey = routingKey;
     }
+    
+    public void setBridgeEndpoint(boolean bridgeEndpoint) {
+        this.bridgeEndpoint = bridgeEndpoint;
+    }
+    
+    public boolean isBridgeEndpoint() {
+        return bridgeEndpoint;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a193ea9c/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 67e3005..3331a7d 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
@@ -80,11 +80,12 @@ public class RabbitMQProducer extends DefaultProducer {
     @Override
     public void process(Exchange exchange) throws Exception {
         String exchangeName = exchange.getIn().getHeader(RabbitMQConstants.EXCHANGE_NAME,
String.class);
-        if (exchangeName == null) {
+        // If it is BridgeEndpoint we should ignore the message header of EXCHANGE_NAME
+        if (exchangeName == null || getEndpoint().isBridgeEndpoint()) {
             exchangeName = getEndpoint().getExchangeName();
         }
         if (ObjectHelper.isEmpty(exchangeName)) {
-            throw new IllegalArgumentException("ExchangeName is not provided in header "
+ RabbitMQConstants.EXCHANGE_NAME);
+            throw new IllegalArgumentException("ExchangeName is not provided in the endpoint:
" + getEndpoint());
         }
 
         String key = exchange.getIn().getHeader(RabbitMQConstants.ROUTING_KEY, "", String.class);


Mime
View raw message