@Override public Destination intercept(Destination destination) { return selectorAware ? new SelectorAwareVirtualTopicInterceptor(destination, this) : new VirtualTopicInterceptor(destination, this); }
private BooleanExpression getExpression(String selector) throws Exception{ BooleanExpression result; synchronized(expressionCache){ result = expressionCache.get(selector); if (result == null){ result = compileSelector(selector); expressionCache.put(selector,result); } } return result; }
private boolean tryMatchingCachedSubs(final Broker broker, Destination dest, MessageEvaluationContext msgContext) { boolean matches = false; LOG.debug("No active consumer match found. Will try cache if configured..."); if (selectorCachePlugin != null) { final Set<String> selectors = selectorCachePlugin.getSelector(dest.getActiveMQDestination().getQualifiedName()); if (selectors != null) { for (String selector : selectors) { try { final BooleanExpression expression = getExpression(selector); matches = expression.matches(msgContext); if (matches) { return true; } } catch (Exception e) { LOG.error(e.getMessage(), e); } } } } return matches; }
/** * Respect the selectors of the subscriptions to ensure only matched messages are dispatched to * the virtual queues, hence there is no build up of unmatched messages on these destinations */ @Override 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; MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(dest.getActiveMQDestination()); msgContext.setMessageReference(message); List<Subscription> subs = dest.getConsumers(); for (Subscription sub : subs) { if (sub.matches(message, msgContext)) { matches = true; break; } } if (matches == false) { matches = tryMatchingCachedSubs(broker, dest, msgContext); } return matches; } return false; }
/** * Respect the selectors of the subscriptions to ensure only matched messages are dispatched to * the virtual queues, hence there is no build up of unmatched messages on these destinations */ @Override protected void send(ProducerBrokerExchange context, Message message, ActiveMQDestination destination) throws Exception { Broker broker = context.getConnectionContext().getBroker(); Set<Destination> destinations = broker.getDestinations(destination); for (Destination dest : destinations) { if (matchesSomeConsumer(message, dest)) { dest.send(context, message.copy()); } } }
/** * Respect the selectors of the subscriptions to ensure only matched messages are dispatched to * the virtual queues, hence there is no build up of unmatched messages on these destinations */ @Override 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; MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(dest.getActiveMQDestination()); msgContext.setMessageReference(message); List<Subscription> subs = dest.getConsumers(); for (Subscription sub : subs) { if (sub.matches(message, msgContext)) { matches = true; break; } } if (matches == false) { matches = tryMatchingCachedSubs(broker, dest, msgContext); } return matches; } return false; }
@Override public Destination intercept(Destination destination) { return selectorAware ? new SelectorAwareVirtualTopicInterceptor(destination, this) : new VirtualTopicInterceptor(destination, this); }
private BooleanExpression getExpression(String selector) throws Exception{ BooleanExpression result; synchronized(expressionCache){ result = expressionCache.get(selector); if (result == null){ result = compileSelector(selector); expressionCache.put(selector,result); } } return result; }
private boolean tryMatchingCachedSubs(final Broker broker, Destination dest, MessageEvaluationContext msgContext) { boolean matches = false; LOG.debug("No active consumer match found. Will try cache if configured..."); if (selectorCachePlugin != null) { final Set<String> selectors = selectorCachePlugin.getSelector(dest.getActiveMQDestination().getQualifiedName()); if (selectors != null) { for (String selector : selectors) { try { final BooleanExpression expression = getExpression(selector); matches = expression.matches(msgContext); if (matches) { return true; } } catch (Exception e) { LOG.error(e.getMessage(), e); } } } } return matches; }
/** * Respect the selectors of the subscriptions to ensure only matched messages are dispatched to * the virtual queues, hence there is no build up of unmatched messages on these destinations */ @Override 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; MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(dest.getActiveMQDestination()); msgContext.setMessageReference(message); List<Subscription> subs = dest.getConsumers(); for (Subscription sub : subs) { if (sub.matches(message, msgContext)) { matches = true; break; } } if (matches == false) { matches = tryMatchingCachedSubs(broker, dest, msgContext); } return matches; } return false; }
@Override public Destination intercept(Destination destination) { return selectorAware ? new SelectorAwareVirtualTopicInterceptor(destination, this) : new VirtualTopicInterceptor(destination, this); }
private BooleanExpression getExpression(String selector) throws Exception{ BooleanExpression result; synchronized(expressionCache){ result = expressionCache.get(selector); if (result == null){ result = compileSelector(selector); expressionCache.put(selector,result); } } return result; }
private boolean tryMatchingCachedSubs(final Broker broker, Destination dest, MessageEvaluationContext msgContext) { boolean matches = false; LOG.debug("No active consumer match found. Will try cache if configured..."); if (selectorCachePlugin != null) { final Set<String> selectors = selectorCachePlugin.getSelector(dest.getActiveMQDestination().getQualifiedName()); if (selectors != null) { for (String selector : selectors) { try { final BooleanExpression expression = getExpression(selector); matches = expression.matches(msgContext); if (matches) { return true; } } catch (Exception e) { LOG.error(e.getMessage(), e); } } } } return matches; }
/** * Respect the selectors of the subscriptions to ensure only matched messages are dispatched to * the virtual queues, hence there is no build up of unmatched messages on these destinations */ @Override 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; MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(dest.getActiveMQDestination()); msgContext.setMessageReference(message); List<Subscription> subs = dest.getConsumers(); for (Subscription sub : subs) { if (sub.matches(message, msgContext)) { matches = true; break; } } if (matches == false) { matches = tryMatchingCachedSubs(broker, dest, msgContext); } return matches; } return false; }
@Override public Destination intercept(Destination destination) { return selectorAware ? new SelectorAwareVirtualTopicInterceptor(destination, this) : new VirtualTopicInterceptor(destination, this); }
private BooleanExpression getExpression(String selector) throws Exception{ BooleanExpression result; synchronized(expressionCache){ result = expressionCache.get(selector); if (result == null){ result = compileSelector(selector); expressionCache.put(selector,result); } } return result; }
private boolean tryMatchingCachedSubs(final Broker broker, Destination dest, MessageEvaluationContext msgContext) { boolean matches = false; LOG.debug("No active consumer match found. Will try cache if configured..."); if (selectorCachePlugin != null) { final Set<String> selectors = selectorCachePlugin.getSelector(dest.getActiveMQDestination().getQualifiedName()); if (selectors != null) { for (String selector : selectors) { try { final BooleanExpression expression = getExpression(selector); matches = expression.matches(msgContext); if (matches) { return true; } } catch (Exception e) { LOG.error(e.getMessage(), e); } } } } return matches; }
public Destination intercept(Destination destination) { return selectorAware ? new SelectorAwareVirtualTopicInterceptor(destination, getPrefix(), getPostfix()) : new VirtualTopicInterceptor(destination, getPrefix(), getPostfix()); }