public void process ( ) { if ( ! receiveQueue . isPresent ( ) ) { initQueue ( ) ; } receiveQueue . ifPresent ( receiveQueue -> { T item ; do { try { item = receiveQueue . poll ( ) ; } catch ( Exception ex ) { logger . debug ( "Unable to receive message" , ex ) ; initQueue ( ) ; item = null ; } if ( item != null ) { sendToEventManager ( item ) ; } } while ( item != null ) ; } ) ; }
Process . This can be called periodically and it will check to see if there are messages on the queue .