FileDocCategorySizeDatePackage
TextLogger.javaAPI DocExample2086Thu Dec 15 21:33:20 GMT 2005com.oreilly.jent.jms

TextLogger

public class TextLogger extends Object implements javax.jms.MessageListener
TextLogger: A simple message listener that logs text messages.

Fields Summary
Constructors Summary
public TextLogger()

Methods Summary
public voidonMessage(javax.jms.Message msg)

    // If it's a text message, print it to stdout
    if (msg instanceof TextMessage) {
      TextMessage tMsg = (TextMessage)msg;
      try {
        System.out.println("Received message: " + tMsg.getText());
      }
      catch (JMSException je) {
        System.out.println("Error retrieving message text: " +
                           je.getMessage());
      }
    }
    // For other types of messages, print an error
    else {
      System.out.println("Unsupported message type encountered.");
    }