public Messages reserve(int numberOfMessages, int timeout, int wait) throws IOException {
        if (numberOfMessages < 1 || numberOfMessages > 100) {
            throw new IllegalArgumentException("numberOfMessages has to be within 1..100");
        }

        MessagesReservationModel payload = new MessagesReservationModel(numberOfMessages, timeout, wait);
        String url = "queues/" + name + "/reservations";
        IronReader reader = client.post(url, gson.toJson(payload));
        Messages messages = gson.fromJson(reader.reader, Messages.class);
        reader.close();
        return messages;
    }
public Messages reserve ( int numberOfMessages , int timeout , int wait ) throws IOException { if ( numberOfMessages < 1 || numberOfMessages > 100 ) { throw new IllegalArgumentException ( "numberOfMessages has to be within 1..100" ) ; } MessagesReservationModel payload = new MessagesReservationModel ( numberOfMessages , timeout , wait ) ; String url = "queues/" + name + "/reservations" ; IronReader reader = client . post ( url , gson . toJson ( payload ) ) ; Messages messages = gson . fromJson ( reader . reader , Messages . class ) ; reader . close ( ) ; return messages ; }
Retrieves Messages from the queue and reserves it. If there are no items on the queue, an
EmptyQueueException is thrown.
@param numberOfMessages The number of messages to receive. Max. is 100.
@param timeout timeout in seconds.
@param wait Time to long poll for messages, in seconds. Max is 30 seconds. Default 0.
@throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK.
@throws java.io.IOException If there is an error accessing the IronMQ server.