public Collection < Message > getMatchingMessages ( final short id , boolean remove ) { return map ( ( msg , batch ) -> { if ( msg != null && msg . getHeader ( id ) != null ) { if ( remove ) batch . remove ( msg ) ; return msg ; } return null ; } ) ; }
Removes and returns all messages which have a header with ID == id