Repository: activemq Updated Branches: refs/heads/activemq-5.12.x 58359a85d -> d5f6b0297 refs/heads/activemq-5.13.x 819e51213 -> e1cf0d267
https://issues.apache.org/jira/browse/AMQ-6070 - set correct originalDestination property value in advisories (cherry picked from commit 75ff17af414b98dbdd891f66b9425692ca799fcc) Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/e1cf0d26 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/e1cf0d26 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/e1cf0d26 Branch: refs/heads/activemq-5.13.x Commit: e1cf0d26782780c96bc9fc0dacc8483af1482ff5 Parents: 819e512 Author: gtully <gary.tu...@gmail.com> Authored: Thu Dec 3 12:11:11 2015 +0000 Committer: Timothy Bish <tabish...@gmail.com> Committed: Thu Dec 3 09:00:27 2015 -0500 ---------------------------------------------------------------------- .../main/java/org/apache/activemq/advisory/AdvisoryBroker.java | 6 +++--- .../test/java/org/apache/activemq/advisory/AdvisoryTests.java | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/e1cf0d26/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java ---------------------------------------------------------------------- diff --git a/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java b/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java index bc5f105..6a485fc 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java @@ -454,7 +454,7 @@ public class AdvisoryBroker extends BrokerFilter { advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString()); ActiveMQDestination destination = payload.getDestination(); if (destination != null) { - advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, payload.getMessageId().toString()); + advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, destination.getQualifiedName()); } fireAdvisory(context, topic, payload, null, advisoryMessage); } @@ -477,7 +477,7 @@ public class AdvisoryBroker extends BrokerFilter { advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString()); ActiveMQDestination destination = payload.getDestination(); if (destination != null) { - advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, payload.getMessageId().toString()); + advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, destination.getQualifiedName()); } fireAdvisory(context, topic, payload, null, advisoryMessage); } @@ -504,7 +504,7 @@ public class AdvisoryBroker extends BrokerFilter { advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_CONSUMER_ID, sub.getConsumerInfo().getConsumerId().toString()); ActiveMQDestination destination = payload.getDestination(); if (destination != null) { - advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, payload.getMessageId().toString()); + advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, destination.getQualifiedName()); } fireAdvisory(context, topic, payload, null, advisoryMessage); } http://git-wip-us.apache.org/repos/asf/activemq/blob/e1cf0d26/activemq-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTests.java ---------------------------------------------------------------------- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTests.java b/activemq-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTests.java index 0863b31..cdd8d99 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTests.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTests.java @@ -152,6 +152,7 @@ public class AdvisoryTests { //This should always be tcp:// because that is the transport that is used to connect even though //the nio transport is the first one in the list assertTrue(((String)message.getProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_URL)).startsWith("tcp://")); + assertEquals(message.getProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION), ((ActiveMQDestination) queue).getQualifiedName()); //Add assertion to make sure body is included for advisory topics //when includeBodyForAdvisory is true @@ -187,6 +188,7 @@ public class AdvisoryTests { //This should always be tcp:// because that is the transport that is used to connect even though //the nio transport is the first one in the list assertTrue(((String)message.getProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_URL)).startsWith("tcp://")); + assertEquals(message.getProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION), ((ActiveMQDestination) queue).getQualifiedName()); //Add assertion to make sure body is included for advisory topics //when includeBodyForAdvisory is true @@ -259,10 +261,9 @@ public class AdvisoryTests { // we should get here without StackOverflow } - @Ignore @Test(timeout = 60000) public void testMessageDiscardedAdvisory() throws Exception { - Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Session s = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); Topic topic = s.createTopic(getClass().getName()); MessageConsumer consumer = s.createConsumer(topic); assertNotNull(consumer); @@ -285,6 +286,7 @@ public class AdvisoryTests { //This should be set assertNotNull(message.getProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_URL)); + assertEquals(message.getProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION), ((ActiveMQDestination) topic).getQualifiedName()); //Add assertion to make sure body is included for advisory topics //when includeBodyForAdvisory is true