public Messages peek ( int numberOfMessages ) throws IOException { if ( numberOfMessages < 1 || numberOfMessages > 100 ) { throw new IllegalArgumentException ( "numberOfMessages has to be within 1..100" ) ; } IronReader reader = client . get ( "queues/" + name + "/messages?n=" + numberOfMessages ) ; try { return gson . fromJson ( reader . reader , Messages . class ) ; } finally { reader . close ( ) ; } }
Peeking at a queue returns the next messages on the queue but it does not reserve them .