protected Message lookupMessage ( String queueName ) { checkStarted ( ) ; try ( Session session = consumerConnection . createSession ( ) ) { Queue queue = ( Queue ) jmsServer . lookup ( QUEUE_NAMESPACE + queueName ) ; Enumeration messages = session . createBrowser ( queue ) . getEnumeration ( ) ; return ( Message ) messages . nextElement ( ) ; } catch ( NoSuchElementException e ) { return null ; } catch ( Exception e ) { throw new AsyncException ( "Lookup failed" , e ) ; } }
This method exists for testing