Message[] messages = destination.browse();
ArrayList<CompositeData> c = new ArrayList<CompositeData>();
MessageEvaluationContext ctx = new MessageEvaluationContext();
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) {