import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.jms.JMSException;

public class SimpleListener implements MessageListener 
{

    public void onMessage(Message message) 
    {
        if (message instanceof TextMessage) 
	    {
		TextMessage text = (TextMessage) message;
		try 
		    {
			System.out.println("Received: " + text.getText());
		    } 
		catch (JMSException exception) 
		    {
			System.err.println("Failed to get message text: " + exception);
		    }
	    }
    }
}
