public Message getNext ( String name ) { synchronized ( _queue ) { for ( int idx = 0 ; idx < _queue . size ( ) ; idx ++ ) { Message m = ( Message ) _queue . get ( idx ) ; if ( m . headers ( ) . get ( "destination" ) . equals ( name ) ) { _queue . remove ( idx ) ; return m ; } } } return null ; }
Get the next unconsumed message for a particular channel . This is non - blocking .