mirror of https://github.com/apache/activemq.git
AMQ-9157 - Add utility methods for dispatched advisory
This commit is contained in:
parent
f473efe163
commit
39da75abdb
|
@ -577,6 +577,24 @@ public final class AdvisorySupport {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isMessageDispatchedAdvisoryTopic(Destination destination) throws JMSException {
|
||||
return isMessageDispatchedAdvisoryTopic(ActiveMQMessageTransformation.transformDestination(destination));
|
||||
}
|
||||
|
||||
public static boolean isMessageDispatchedAdvisoryTopic(ActiveMQDestination destination) {
|
||||
if (destination.isComposite()) {
|
||||
ActiveMQDestination[] compositeDestinations = destination.getCompositeDestinations();
|
||||
for (int i = 0; i < compositeDestinations.length; i++) {
|
||||
if (isMessageDispatchedAdvisoryTopic(compositeDestinations[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return destination.isTopic() && destination.getPhysicalName().startsWith(MESSAGE_DISPATCHED_TOPIC_PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the agent topic which is used to send commands to the broker
|
||||
*/
|
||||
|
|
|
@ -214,6 +214,10 @@ public class AdvisoryTests {
|
|||
|
||||
Topic advisoryTopic = AdvisorySupport.getMessageDispatchedAdvisoryTopic(
|
||||
(ActiveMQDestination) queue);
|
||||
|
||||
//Test util method
|
||||
assertTrue(AdvisorySupport.isMessageDispatchedAdvisoryTopic(advisoryTopic));
|
||||
|
||||
MessageConsumer advisoryConsumer = s.createConsumer(advisoryTopic);
|
||||
// start throwing messages at the consumer
|
||||
MessageProducer producer = s.createProducer(queue);
|
||||
|
|
Loading…
Reference in New Issue