private boolean suppressMessageDispatch(MessageDispatch md, DemandSubscription sub) throws Exception { boolean suppress = false; // for durable subs, suppression via filter leaves dangling acks so we // need to check here and allow the ack irrespective if (sub.getLocalInfo().isDurable()) { NonCachedMessageEvaluationContext messageEvalContext = new NonCachedMessageEvaluationContext(); messageEvalContext.setMessageReference(md.getMessage()); messageEvalContext.setDestination(md.getDestination()); suppress = !sub.getNetworkBridgeFilter().matches(messageEvalContext); } return suppress; }
public ConnectionContext() { this.messageEvaluationContext = new NonCachedMessageEvaluationContext(); }
public JournalMessageStore(JournalPersistenceAdapter adapter, MessageStore checkpointStore, ActiveMQDestination destination) { super(destination); this.peristenceAdapter = adapter; this.transactionStore = adapter.getTransactionStore(); this.longTermStore = checkpointStore; this.transactionTemplate = new TransactionTemplate(adapter, new ConnectionContext(new NonCachedMessageEvaluationContext())); }
/** * Browses the current destination with the given selector returning a list * of messages */ @Override public List<Object> browseMessages(String selector) throws InvalidSelectorException { Message[] messages = destination.browse(); ArrayList<Object> answer = new ArrayList<Object>(); NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext(); ctx.setDestination(destination.getActiveMQDestination()); BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector); for (int i = 0; i < messages.length; i++) { try { Message message = messages[i]; message.setReadOnlyBody(true); if (selectorExpression == null) { answer.add(message); } else { ctx.setMessageReference(message); if (selectorExpression.matches(ctx)) { answer.add(message); } } } catch (Throwable e) { LOG.warn("exception browsing destination", e); } } return answer; }
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 CompositeData[] browse(String selector) throws OpenDataException, InvalidSelectorException { Message[] messages = destination.browse(); ArrayList<CompositeData> c = new ArrayList<CompositeData>(); NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext(); ctx.setDestination(destination.getActiveMQDestination()); BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector); for (int i = 0; i < messages.length; i++) { try { if (selectorExpression == null) { c.add(OpenTypeSupport.convert(messages[i])); } else { ctx.setMessageReference(messages[i]); if (selectorExpression.matches(ctx)) { c.add(OpenTypeSupport.convert(messages[i])); } } } catch (Throwable e) { LOG.warn("exception browsing destination", e); } } CompositeData rc[] = new CompositeData[c.size()]; c.toArray(rc); return rc; }
@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; }
@Override public TabularData browseAsTable(String selector) throws OpenDataException, InvalidSelectorException { OpenTypeFactory factory = OpenTypeSupport.getFactory(ActiveMQMessage.class); Message[] messages = destination.browse(); CompositeType ct = factory.getCompositeType(); TabularType tt = new TabularType("MessageList", "MessageList", ct, new String[] { "JMSMessageID" }); TabularDataSupport rc = new TabularDataSupport(tt); NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext(); ctx.setDestination(destination.getActiveMQDestination()); BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector); for (int i = 0; i < messages.length; i++) { try { if (selectorExpression == null) { rc.put(new CompositeDataSupport(ct, factory.getFields(messages[i]))); } else { ctx.setMessageReference(messages[i]); if (selectorExpression.matches(ctx)) { rc.put(new CompositeDataSupport(ct, factory.getFields(messages[i]))); } } } catch (Throwable e) { LOG.warn("exception browsing destination", e); } } return rc; }
FilteredDestination filteredDestination = (FilteredDestination)value; if (messageContext == null) { messageContext = new NonCachedMessageEvaluationContext(); messageContext.setMessageReference(message);
private boolean suppressMessageDispatch(MessageDispatch md, DemandSubscription sub) throws Exception { boolean suppress = false; // for durable subs, suppression via filter leaves dangling acks so we // need to check here and allow the ack irrespective if (sub.getLocalInfo().isDurable()) { NonCachedMessageEvaluationContext messageEvalContext = new NonCachedMessageEvaluationContext(); messageEvalContext.setMessageReference(md.getMessage()); messageEvalContext.setDestination(md.getDestination()); suppress = !sub.getNetworkBridgeFilter().matches(messageEvalContext); } return suppress; }
BrowserDispatch browserDispatch = browsers.next(); try { MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(destination);
private boolean suppressMessageDispatch(MessageDispatch md, DemandSubscription sub) throws Exception { boolean suppress = false; // for durable subs, suppression via filter leaves dangling acks so we // need to check here and allow the ack irrespective if (sub.getLocalInfo().isDurable()) { NonCachedMessageEvaluationContext messageEvalContext = new NonCachedMessageEvaluationContext(); messageEvalContext.setMessageReference(md.getMessage()); messageEvalContext.setDestination(md.getDestination()); suppress = !sub.getNetworkBridgeFilter().matches(messageEvalContext); } return suppress; }
/** * 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; }
private boolean suppressMessageDispatch(MessageDispatch md, DemandSubscription sub) throws Exception { boolean suppress = false; // for durable subs, suppression via filter leaves dangling acks so we // need to check here and allow the ack irrespective if (sub.getLocalInfo().isDurable()) { NonCachedMessageEvaluationContext messageEvalContext = new NonCachedMessageEvaluationContext(); messageEvalContext.setMessageReference(md.getMessage()); messageEvalContext.setDestination(md.getDestination()); suppress = !sub.getNetworkBridgeFilter().matches(messageEvalContext); } return suppress; }
final MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(destination); if (subscription.isRecoveryRequired()) {
@Override public CompositeData[] browse(String selector) throws OpenDataException, InvalidSelectorException { Message[] messages = destination.browse(); ArrayList<CompositeData> c = new ArrayList<CompositeData>(); NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext(); ctx.setDestination(destination.getActiveMQDestination()); BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector); for (int i = 0; i < messages.length; i++) { try { if (selectorExpression == null) { c.add(OpenTypeSupport.convert(messages[i])); } else { ctx.setMessageReference(messages[i]); if (selectorExpression.matches(ctx)) { c.add(OpenTypeSupport.convert(messages[i])); } } } catch (Throwable e) { LOG.warn("exception browsing destination", e); } } CompositeData rc[] = new CompositeData[c.size()]; c.toArray(rc); return rc; }
ConnectionContext context = new ConnectionContext(new NonCachedMessageEvaluationContext());
/** * Browses the current destination with the given selector returning a list * of messages */ @Override public List<Object> browseMessages(String selector) throws InvalidSelectorException { Message[] messages = destination.browse(); ArrayList<Object> answer = new ArrayList<Object>(); NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext(); ctx.setDestination(destination.getActiveMQDestination()); BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector); for (int i = 0; i < messages.length; i++) { try { Message message = messages[i]; message.setReadOnlyBody(true); if (selectorExpression == null) { answer.add(message); } else { ctx.setMessageReference(message); if (selectorExpression.matches(ctx)) { answer.add(message); } } } catch (Throwable e) { LOG.warn("exception browsing destination", e); } } return answer; }
public ConnectionContext() { this.messageEvaluationContext = new NonCachedMessageEvaluationContext(); }
/** * Browses the current destination with the given selector returning a list * of messages */ @Override public List<Object> browseMessages(String selector) throws InvalidSelectorException { Message[] messages = destination.browse(); ArrayList<Object> answer = new ArrayList<Object>(); NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext(); ctx.setDestination(destination.getActiveMQDestination()); BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector); for (int i = 0; i < messages.length; i++) { try { Message message = messages[i]; message.setReadOnlyBody(true); if (selectorExpression == null) { answer.add(message); } else { ctx.setMessageReference(message); if (selectorExpression.matches(ctx)) { answer.add(message); } } } catch (Throwable e) { LOG.warn("exception browsing destination", e); } } return answer; }