Create a JMS message listener

From Resin 3.0

Jump to: navigation, search


Writing a Message Listener

The JMS MessageListener interface has a single method onMessage(Message).

A simple message application can implement that message listener waiting to receive messages from the queue.

import javax.jms.*;

public class MyListener implements MessageListener {
  public void onMessage(Message message)
     TextMessage text = (TextMessage) message;

     System.out.println("Message: " + text.getText());

Configuring a Listener Resource


 <web-app xmlns="">
 <ejb-message-bean class="example.MyListener">


See Also

Personal tools