List of usage examples for javax.jms QueueSession createBrowser
QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException;
From source file:nl.nn.adapterframework.jms.JmsMessageBrowser.java
protected Message doBrowse(Map selectors) throws ListenerException { QueueSession session = null; Message msg = null;/*from w w w . ja v a 2 s. co m*/ QueueBrowser queueBrowser = null; try { session = (QueueSession) createSession(); queueBrowser = session.createBrowser((Queue) getDestination(), getCombinedSelector(selectors)); Enumeration msgenum = queueBrowser.getEnumeration(); if (msgenum.hasMoreElements()) { msg = (Message) msgenum.nextElement(); } return msg; } catch (Exception e) { throw new ListenerException(e); } finally { try { if (queueBrowser != null) { queueBrowser.close(); } } catch (JMSException e1) { throw new ListenerException("exception closing queueBrowser", e1); } closeSession(session); } }