package com.idtect.detector.message;

import java.util.*;
import java.io.*;
import javax.jms.*;
import org.apache.commons.messagelet.impl.*;
import org.apache.commons.messenger.*;
import org.apache.log4j.Logger;

/**
 * @author michael
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class PingTopicListener implements MessageListener {

  private static Logger log = Logger.getLogger(PingTopicListener.class.getName());

  public void onMessage(Message message) {
    TextMessage msg = null;
    try {
      if (message instanceof TextMessage) {
        msg = (TextMessage) message;
        log.debug("Received text message : " + msg.getText());
      } else {
        log.warn("Message of wrong type: " + message.getClass().getName());
      }
    } catch (JMSException e) {
      log.warn("JMSException in onMessage(): " + e.toString(), e);
    }
  }
}
