org.exolab.jmscts.core
Interface MessageReceiver


public interface MessageReceiver

Interface for receiving messages from a MessageConsumer or QueueBrowser.

Version:
$Revision: 1.7 $ $Date: 2004/02/03 21:52:06 $
Author:
Tim Anderson

Method Summary
 void close()
          Close the underlying MessageConsumer or QueueBrowser
 javax.jms.Destination getDestination()
          Return the destination associated with the MessageConsumer
 java.lang.String getName()
          Returns the name of the subscriber, if the consumer is a durable topic subscriber
 boolean getNoLocal()
          Returns the no-local value, if the consumer is a topic subscriber
 java.lang.String getSelector()
          Returns the message selector associated with the MessageConsumer
 java.util.List receive(int count, long timeout)
          Return a list of Message instances from a MessageConsumer or QueueBrowser
 void receive(long timeout, CountingListener listener)
          Receive messages, delegating received messages to a CountingListener
 void remove()
          Close the underlying MessageConsumer or QueueBrowser.
 

Method Detail

receive

public java.util.List receive(int count,
                              long timeout)
                       throws javax.jms.JMSException
Return a list of Message instances from a MessageConsumer or QueueBrowser
Parameters:
count - the number of messages expected. This is indicative only; implementations may return less (if messages aren't available) or more (if an asynchronous implementation is used) messages than the specified value.
timeout - the maximum time to wait for each message. If set to 0, then it waits until a message becomes available.
Returns:
a list of messages, or null, if no messages were received in the specified time
Throws:
javax.jms.JMSException - if the operation fails

receive

public void receive(long timeout,
                    CountingListener listener)
             throws javax.jms.JMSException
Receive messages, delegating received messages to a CountingListener
Parameters:
timeout - the maximum time to wait for each message. If set to 0, then it waits until a message becomes available.
listener - the listener to delegate messages to
Throws:
javax.jms.JMSException - if the operation fails

getDestination

public javax.jms.Destination getDestination()
                                     throws javax.jms.JMSException
Return the destination associated with the MessageConsumer
Returns:
the destination to receive messages from
Throws:
javax.jms.JMSException - if the operation fails

getSelector

public java.lang.String getSelector()
                             throws javax.jms.JMSException
Returns the message selector associated with the MessageConsumer
Returns:
the message selector
Throws:
javax.jms.JMSException - if the operation fails

getName

public java.lang.String getName()
Returns the name of the subscriber, if the consumer is a durable topic subscriber
Returns:
the name of the subscriber, or null if the consumer is not a durable topic subscriber

getNoLocal

public boolean getNoLocal()
                   throws javax.jms.JMSException
Returns the no-local value, if the consumer is a topic subscriber
Returns:
the no-local value, if the consumer is a topic subscriber; otherwise false
Throws:
javax.jms.JMSException - if the operation fails

close

public void close()
           throws javax.jms.JMSException
Close the underlying MessageConsumer or QueueBrowser
Throws:
javax.jms.JMSException - if the operation fails

remove

public void remove()
            throws javax.jms.JMSException
Close the underlying MessageConsumer or QueueBrowser. For durable topic subscribers, unsubscribe it from the session.
Throws:
javax.jms.JMSException - if the operation fails


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