From 2727496c0027109acf8f55659396154099fff2a1 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Wed, 21 Nov 2012 14:33:58 +0000 Subject: [PATCH] Support the no-local option over AMQP. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1412127 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/transport/amqp/AmqpProtocolConverter.java | 5 +++++ .../java/org/apache/activemq/filter/NoLocalExpression.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java index ba501a331e..4f53a930a4 100644 --- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java +++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java @@ -59,6 +59,7 @@ class AmqpProtocolConverter { private final AmqpTransport amqpTransport; private static final Symbol COPY = Symbol.getSymbol("copy"); private static final Symbol JMS_SELECTOR = Symbol.valueOf("jms-selector"); + private static final Symbol NO_LOCAL = Symbol.valueOf("no-local"); public AmqpProtocolConverter(AmqpTransport amqpTransport, BrokerContext brokerContext) { this.amqpTransport = amqpTransport; @@ -909,6 +910,10 @@ class AmqpProtocolConverter { if( value!=null ) { consumerInfo.setSelector(value.getDescribed().toString()); } + value = (DescribedType)filter.get(NO_LOCAL); + if( value!=null ) { + consumerInfo.setNoLocal(true); + } } sendToActiveMQ(consumerInfo, new ResponseHandler() { diff --git a/activemq-client/src/main/java/org/apache/activemq/filter/NoLocalExpression.java b/activemq-client/src/main/java/org/apache/activemq/filter/NoLocalExpression.java index cc1c961363..deba0a3f21 100755 --- a/activemq-client/src/main/java/org/apache/activemq/filter/NoLocalExpression.java +++ b/activemq-client/src/main/java/org/apache/activemq/filter/NoLocalExpression.java @@ -35,7 +35,8 @@ public class NoLocalExpression implements BooleanExpression { if (message.isDropped()) { return false; } - return !connectionId.equals(message.getMessage().getMessageId().getProducerId().getConnectionId()); + String messageConnectionId = message.getMessage().getProducerId().getConnectionId(); + return !connectionId.equals(messageConnectionId); } catch (IOException e) { throw JMSExceptionSupport.create(e); }