title: How can I implement JMS MessageListener?
body: <p>I tried to implement MessageListener, but it dosen't work, but when I use MessageListner, it doesn't work. So what should I do that MessageListener starts working, I'm using jboss 4.02.</p>
  
  <pre><code>recv.receive(); // This works
  
  recv.setMessageListener(new ExListener()); // This doesn't work
  
      public static class ExListener 
      implements MessageListener
      {
          public void onMessage(Message msg)
          {
              TextMessage tm = (TextMessage) msg;
              try {
                  System.out.println("onMessage, recv text="+tm.getText());
              } catch(Throwable t) {
                  t.printStackTrace();
              }
          }
      }
  </code></pre>