@Override public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message {}", message, e); } return true; }
public boolean canDispatch(Subscription subscription, MessageReference node) throws Exception { MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(this.destination); msgContext.setMessageReference(node); return subscription.matches(node, msgContext); } }
@Override public boolean evaluate(ConnectionContext context, MessageReference r) throws JMSException { MessageEvaluationContext messageEvaluationContext = context.getMessageEvaluationContext(); messageEvaluationContext.setMessageReference(r); if (messageEvaluationContext.getDestination() == null) { messageEvaluationContext.setDestination(getActiveMQDestination()); } return selectorExpression.matches(messageEvaluationContext); } };
@Override public synchronized boolean recoverMessage(Message message, boolean cached) throws Exception { LOG.trace("{} recover: {}, priority: {}", this, message.getMessageId(), message.getPriority()); boolean recovered = false; MessageEvaluationContext messageEvaluationContext = new NonCachedMessageEvaluationContext(); messageEvaluationContext.setMessageReference(message); if (this.subscription.matches(message, messageEvaluationContext)) { recovered = super.recoverMessage(message, cached); if (recovered && !cached) { lastRecoveredPriority = message.getPriority(); } storeHasMessages = true; } return recovered; }
if (messageContext == null) { messageContext = new NonCachedMessageEvaluationContext(); messageContext.setMessageReference(message);
for (MessageReference node : messagesInMemory) { if (!((QueueMessageReference)node).isAcked() && !browser.isDuplicate(node.getMessageId()) && !browser.atMax()) { msgContext.setMessageReference(node); if (browser.matches(node, msgContext)) { browser.add(node);
@Override public boolean addRecoveredMessage(ConnectionContext context, MessageReference message) throws Exception { boolean result = false; MessageEvaluationContext msgContext = context.getMessageEvaluationContext(); try { Destination regionDestination = (Destination) message.getRegionDestination(); msgContext.setDestination(regionDestination.getActiveMQDestination()); msgContext.setMessageReference(message); result = matches(message, msgContext); if (result) { doAddRecoveredMessage(message); } } finally { msgContext.clear(); } return result; }
msgContext.setMessageReference(message); if (!dispatchPolicy.dispatch(message, msgContext, consumers)) { onMessageWithNoConsumers(context, message);
/** * 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; }
public boolean accept(Message message) { try { MessageEvaluationContext context = new MessageEvaluationContext(); MessageAdapter ma = new MessageAdapter(message); context.setMessageReference(ma); return expression.matches(context); } catch (Exception e) { throw new RuntimeException("ActiveMQ selector accept error " + message, e); } }
@Override public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message {}", message, e); } return true; }
public boolean recoverMessage(Message message) throws Exception { message.setRegionDestination(Topic.this); try { msgContext.setMessageReference(message); if (subscription.matches(message, msgContext)) { subscription.add(message); } } catch (IOException e) { LOG.error("Failed to recover this message " + message); } return true; }
public boolean canDispatch(Subscription subscription, MessageReference node) throws Exception { MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(this.destination); msgContext.setMessageReference(node); return subscription.matches(node, msgContext); } }
public boolean canDispatch(Subscription subscription, MessageReference node) throws Exception { MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(this.destination); msgContext.setMessageReference(node); return subscription.matches(node, msgContext); } }
public boolean recoverMessageReference(MessageId ref) throws Exception { if (selectorExpression != null) { MessageEvaluationContext ctx = new MessageEvaluationContext(); ctx.setMessageReference(store.getMessage(ref)); if (selectorExpression.matches(ctx)) { count++; } } else { count ++; } return true; }
public boolean canDispatch(Subscription subscription, MessageReference node) throws Exception { MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(this.destination); msgContext.setMessageReference(node); return subscription.matches(node, msgContext); } }
@Override public boolean evaluate(ConnectionContext context, MessageReference r) throws JMSException { MessageEvaluationContext messageEvaluationContext = context.getMessageEvaluationContext(); messageEvaluationContext.setMessageReference(r); if (messageEvaluationContext.getDestination() == null) { messageEvaluationContext.setDestination(getActiveMQDestination()); } return selectorExpression.matches(messageEvaluationContext); } };
@Override public boolean evaluate(ConnectionContext context, MessageReference r) throws JMSException { MessageEvaluationContext messageEvaluationContext = context.getMessageEvaluationContext(); messageEvaluationContext.setMessageReference(r); if (messageEvaluationContext.getDestination() == null) { messageEvaluationContext.setDestination(getActiveMQDestination()); } return selectorExpression.matches(messageEvaluationContext); } };
@Override public boolean evaluate(ConnectionContext context, MessageReference r) throws JMSException { MessageEvaluationContext messageEvaluationContext = context.getMessageEvaluationContext(); messageEvaluationContext.setMessageReference(r); if (messageEvaluationContext.getDestination() == null) { messageEvaluationContext.setDestination(getActiveMQDestination()); } return selectorExpression.matches(messageEvaluationContext); } };
public boolean evaluate(ConnectionContext context, MessageReference r) throws JMSException { MessageEvaluationContext messageEvaluationContext = context.getMessageEvaluationContext(); messageEvaluationContext.setMessageReference(r); if (messageEvaluationContext.getDestination() == null) { messageEvaluationContext.setDestination(getActiveMQDestination()); } return selectorExpression.matches(messageEvaluationContext); } };