code: static void closeQuietly(MessageProducer producer) {
      InputStream message;
      while ((message = producer.next()) != null) {
        closeQuietly(message);
      }
    }
docs: Quietly closes all messages in MessageProducer.