1 18 package org.apache.activemq.broker.region.policy; 19 20 21 import java.util.Iterator ; 22 import java.util.List ; 23 import org.apache.activemq.broker.region.MessageReference; 24 import org.apache.activemq.broker.region.Subscription; 25 import org.apache.activemq.filter.MessageEvaluationContext; 26 27 35 public class SimpleDispatchPolicy implements DispatchPolicy { 36 37 public boolean dispatch(MessageReference node, MessageEvaluationContext msgContext, List consumers) throws Exception { 38 int count = 0; 39 for (Iterator iter = consumers.iterator(); iter.hasNext();) { 40 Subscription sub = (Subscription) iter.next(); 41 42 if( sub.getConsumerInfo().isBrowser() ) 44 continue; 45 if (!sub.matches(node, msgContext)) 47 continue; 48 49 sub.add(node); 50 count++; 51 } 52 return count > 0; 53 } 54 55 } 56 | Popular Tags |