protected void requestLoop() throws Exception {

        for (int i = 0; i < messageCount || messageCount == 0; i++) {

            TextMessage message = session.createTextMessage(createMessageText(i));
            message.setJMSReplyTo(replyDest);

            if (verbose) {
                String msg = message.getText();
                if (msg.length() > 50) {
                    msg = msg.substring(0, 50) + "...";
                }
                System.out.println("Sending message: " + msg);
            }

            producer.send(message);
            if (transacted) {
                session.commit();
            }

            System.out.println("Waiting for reponse message...");
            Message message2 = consumer.receive();
            if (message2 instanceof TextMessage) {
                System.out.println("Reponse message: " + ((TextMessage)message2).getText());
            } else {
                System.out.println("Reponse message: " + message2);
            }
            if (transacted) {
                session.commit();
            }

            Thread.sleep(sleepTime);

        }
    }