1 18 package org.apache.activemq.filter; 19 20 import java.io.IOException ; 21 22 import javax.jms.JMSException ; 23 24 import org.apache.activemq.util.JMSExceptionSupport; 25 26 public class NoLocalExpression implements BooleanExpression { 27 28 private final String connectionId; 29 30 public NoLocalExpression(String connectionId) { 31 this.connectionId = connectionId; 32 } 33 34 public boolean matches(MessageEvaluationContext message) throws JMSException { 35 try { 36 if( message.isDropped() ) 37 return false; 38 return !connectionId.equals(message.getMessage().getMessageId().getProducerId().getConnectionId()); 39 } catch (IOException e) { 40 throw JMSExceptionSupport.create(e); 41 } 42 } 43 44 public Object evaluate(MessageEvaluationContext message) throws JMSException { 45 return matches(message) ? Boolean.TRUE : Boolean.FALSE; 46 } 47 48 } 49 | Popular Tags |