org.exolab.jmscts.core
Class CachingListener

java.lang.Object
  |
  +--org.exolab.jmscts.core.CountingListener
        |
        +--org.exolab.jmscts.core.CachingListener
All Implemented Interfaces:
javax.jms.MessageListener

public class CachingListener
extends CountingListener

Helper class for receiving messages asynchronously and caching them

Version:
$Revision: 1.4 $ $Date: 2004/01/31 13:44:24 $
Author:
Tim Anderson

Constructor Summary
CachingListener(int expected)
          Construct an instance of the listener, with the number of messages expected to be received.
 
Method Summary
 java.util.List getMessages()
          Returns the list of received messages
 void onMessage(javax.jms.Message message)
          This method is asynchronously invoked by the message consumer when a message becomes available.
 
Methods inherited from class org.exolab.jmscts.core.CountingListener
getExpected, getReceived, waitForCompletion, waitForCompletion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingListener

public CachingListener(int expected)
Construct an instance of the listener, with the number of messages expected to be received. When this count is reached, the listener notifies the waiting client (if any)
Parameters:
expected - the number of messages expected
Method Detail

onMessage

public void onMessage(javax.jms.Message message)
This method is asynchronously invoked by the message consumer when a message becomes available.
Overrides:
onMessage in class CountingListener
Parameters:
message - the received message

getMessages

public java.util.List getMessages()
Returns the list of received messages
Returns:
the list of received messages, or null, if no messages have been received


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.