Message listener

From Resin 3.0

Revision as of 15:49, 2 December 2011 by Pcowan (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
40px-Edit-clear.png This article requires cleanup and may refer to a legacy version of Resin.

Please visit for the most up-to-date documentation.

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

<resource type="com.caucho.jms.resource.ListenerResource">


     <listener type="example.MyListener"/>
Personal tools