This commit is contained in:
Clebert Suconic 2017-12-18 22:24:43 -05:00
commit 2d81f2d4bb
2 changed files with 8 additions and 3 deletions

View File

@ -95,7 +95,7 @@ public class AMQConsumer {
} else { } else {
preAck = true; preAck = true;
} }
String noLocalSelector = MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + this.getId().getConnectionId() + "'"; String noLocalSelector = MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + info.getClientId() + "'";
if (selector == null) { if (selector == null) {
selector = new SimpleString(noLocalSelector); selector = new SimpleString(noLocalSelector);
} else { } else {

View File

@ -26,6 +26,7 @@ import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import javax.jms.TopicSubscriber; import javax.jms.TopicSubscriber;
import org.apache.activemq.artemis.reader.MessageUtil;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.RandomUtil;
@ -145,7 +146,9 @@ public class NoLocalSubscriberTest extends JMSTestBase {
connection.setClientID(clientID); connection.setClientID(clientID);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(topic); MessageProducer messageProducer = session.createProducer(topic);
messageProducer.send(session.createTextMessage("M3")); TextMessage textMessage = session.createTextMessage("M3");
textMessage.setStringProperty(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString(), clientID);
messageProducer.send(textMessage);
connection.close(); connection.close();
} }
@ -157,7 +160,9 @@ public class NoLocalSubscriberTest extends JMSTestBase {
connection.setClientID(clientID + "_different"); connection.setClientID(clientID + "_different");
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(topic); MessageProducer messageProducer = session.createProducer(topic);
messageProducer.send(session.createTextMessage("M4")); TextMessage textMessage = session.createTextMessage("M4");
textMessage.setStringProperty(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString(), clientID + "_different");
messageProducer.send(textMessage);
connection.close(); connection.close();
} }