mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-6070 - set correct originalDestination property value in advisories
This commit is contained in:
parent
d346a765e3
commit
75ff17af41
|
@ -454,7 +454,7 @@ public class AdvisoryBroker extends BrokerFilter {
|
||||||
advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString());
|
advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString());
|
||||||
ActiveMQDestination destination = payload.getDestination();
|
ActiveMQDestination destination = payload.getDestination();
|
||||||
if (destination != null) {
|
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);
|
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());
|
advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString());
|
||||||
ActiveMQDestination destination = payload.getDestination();
|
ActiveMQDestination destination = payload.getDestination();
|
||||||
if (destination != null) {
|
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);
|
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());
|
advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_CONSUMER_ID, sub.getConsumerInfo().getConsumerId().toString());
|
||||||
ActiveMQDestination destination = payload.getDestination();
|
ActiveMQDestination destination = payload.getDestination();
|
||||||
if (destination != null) {
|
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);
|
fireAdvisory(context, topic, payload, null, advisoryMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,7 @@ public class AdvisoryTests {
|
||||||
//This should always be tcp:// because that is the transport that is used to connect even though
|
//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
|
//the nio transport is the first one in the list
|
||||||
assertTrue(((String)message.getProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_URL)).startsWith("tcp://"));
|
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
|
//Add assertion to make sure body is included for advisory topics
|
||||||
//when includeBodyForAdvisory is true
|
//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
|
//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
|
//the nio transport is the first one in the list
|
||||||
assertTrue(((String)message.getProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_URL)).startsWith("tcp://"));
|
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
|
//Add assertion to make sure body is included for advisory topics
|
||||||
//when includeBodyForAdvisory is true
|
//when includeBodyForAdvisory is true
|
||||||
|
@ -259,10 +261,9 @@ public class AdvisoryTests {
|
||||||
// we should get here without StackOverflow
|
// we should get here without StackOverflow
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test(timeout = 60000)
|
@Test(timeout = 60000)
|
||||||
public void testMessageDiscardedAdvisory() throws Exception {
|
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());
|
Topic topic = s.createTopic(getClass().getName());
|
||||||
MessageConsumer consumer = s.createConsumer(topic);
|
MessageConsumer consumer = s.createConsumer(topic);
|
||||||
assertNotNull(consumer);
|
assertNotNull(consumer);
|
||||||
|
@ -285,6 +286,7 @@ public class AdvisoryTests {
|
||||||
|
|
||||||
//This should be set
|
//This should be set
|
||||||
assertNotNull(message.getProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_URL));
|
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
|
//Add assertion to make sure body is included for advisory topics
|
||||||
//when includeBodyForAdvisory is true
|
//when includeBodyForAdvisory is true
|
||||||
|
|
Loading…
Reference in New Issue