code: public List<String> receiveTextMessages(int maxSize) {
          List<String> messages = new ArrayList<>();
          try {
              while (messages.size() <= maxSize){
                  TextMessage message = (TextMessage) consumer.receive(timeout);
                  if (message == null) {
                      return messages;
                  }else {
                      messages.add(message.getText());
                  }
              }
          } catch (JMSException e) {
              throw new AsyncException(e);
          }
          return messages;
      }
docs: Receives and returns <code>size</code> Strings from the queue.
  Presumes that messages in queue are {@link TextMessage}.
  
  @param maxSize maximum number of messages to receive
  @return <code>size</code> messages from the queue.