Updating patch to make sure SelectorAwareVirtualTopics are covered
and code cleanup
This commit is contained in:
Christopher L. Shannon (cshannon) 2015-11-23 20:35:32 +00:00
parent bf36c4cb88
commit bc9edf00d1
2 changed files with 19 additions and 18 deletions

View File

@ -50,6 +50,8 @@ public class SelectorAwareVirtualTopicInterceptor extends VirtualTopicIntercepto
*/ */
@Override @Override
protected boolean shouldDispatch(final Broker broker, Message message, Destination dest) throws IOException { protected boolean shouldDispatch(final Broker broker, Message message, Destination dest) throws IOException {
//first validate that the prefix matches in the super class
if (super.shouldDispatch(broker, message, dest)) {
boolean matches = false; boolean matches = false;
MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext();
msgContext.setDestination(dest.getActiveMQDestination()); msgContext.setDestination(dest.getActiveMQDestination());
@ -66,6 +68,8 @@ public class SelectorAwareVirtualTopicInterceptor extends VirtualTopicIntercepto
} }
return matches; return matches;
} }
return false;
}
private boolean tryMatchingCachedSubs(final Broker broker, Destination dest, MessageEvaluationContext msgContext) { private boolean tryMatchingCachedSubs(final Broker broker, Destination dest, MessageEvaluationContext msgContext) {
boolean matches = false; boolean matches = false;

View File

@ -142,11 +142,8 @@ public class VirtualTopicInterceptor extends DestinationFilter {
} }
protected boolean shouldDispatch(Broker broker, Message message, Destination dest) throws IOException { protected boolean shouldDispatch(Broker broker, Message message, Destination dest) throws IOException {
//can't find .* in the prefix, so default back to old logic and return true //if can't find .* in the prefix, default back to old logic and return true
if(prefix.indexOf(".*")>0){ return prefix.contains(".*") ? dest.getName().startsWith(prefix.substring(0, prefix.indexOf(".*"))) : true;
return dest.getName().startsWith(prefix.substring(0,prefix.indexOf(".*")));
}
else return true;
} }
protected ActiveMQDestination getQueueConsumersWildcard(ActiveMQDestination original) { protected ActiveMQDestination getQueueConsumersWildcard(ActiveMQDestination original) {