org.exolab.jms.messagemgr
Class QueueBrowserEndpoint

java.lang.Object
  |
  +--org.exolab.jms.messagemgr.ConsumerEndpoint
        |
        +--org.exolab.jms.messagemgr.QueueBrowserEndpoint
All Implemented Interfaces:
DestinationCacheEventListener, Identifiable, QueueListener, java.lang.Runnable, java.io.Serializable

public class QueueBrowserEndpoint
extends ConsumerEndpoint
implements QueueListener

A QueueBrowserEndpoint is a QueueListener to a QueueDestinationCache. This enables it to receive all the messages, which it then feeds down to the client side.

Version:
$Revision: 1.24 $ $Date: 2003/08/13 13:30:54 $
Author:
Jim Alateras
See Also:
Serialized Form

Fields inherited from class org.exolab.jms.messagemgr.ConsumerEndpoint
_ackMode, _connectionId, _listener, _nolocal, _scheduler, _selector, _session, _size, _transacted, _waitingForMessage, _waitingForMessageMonitor
 
Method Summary
 boolean deliverMessages()
          Deliver messages in the cache to the consumer.
protected  void doClose()
          Closes this endpoint
 JmsDestination getDestination()
          Return the destination that this consumer is subscribed to
 void onMessage(MessageImpl message)
          This method is called when a new message is added to a queue cache
 MessageHandle receiveMessage(long wait)
          Return the next message to the client.
 java.util.Vector receiveMessages(int count)
          Return, at most, count messages from the cache.
 void returnMessage(MessageHandle handle)
          Return the specified message to the cache.
 void setMessageListener(InternalMessageListener listener)
          Set the message listener for this consmer.
 void unregister()
          Unregister this consumer for the specified destination cache, so that it will stop receiving messages from it.
 
Methods inherited from class org.exolab.jms.messagemgr.ConsumerEndpoint
addMessage, addMessage, clearMessages, clearWaitingForMessage, close, collectGarbage, collectionHasPersistentHandles, containsMessage, deleteMessage, getAckMode, getClientId, getConnectionId, getId, getMaximumSize, getMessage, getMessageCount, getNoLocal, getPersistentId, getSelector, getSession, getTransacted, hashCode, isStopped, isWaitingForMessage, messageAdded, messageRemoved, notifyMessageAvailable, persistentMessageAdded, persistentMessageRemoved, recover, removeFirstMessage, removeMessage, run, schedule, setAckMode, setCacheEvictionPolicy, setConnectionId, setMaximumSize, setNoLocal, setSelector, setStopped, setTransacted, setWaitingForMessage, stopDelivery, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

deliverMessages

public boolean deliverMessages()
Deliver messages in the cache to the consumer.

This is not relevant to QueueBrowsers, and thus shouldn't be invoked.

Overrides:
deliverMessages in class ConsumerEndpoint
Returns:
false

receiveMessage

public MessageHandle receiveMessage(long wait)
Description copied from class: ConsumerEndpoint
Return the next message to the client. This will also mark the message as sent and move it to the sent queue
Overrides:
receiveMessage in class ConsumerEndpoint
Following copied from class: org.exolab.jms.messagemgr.ConsumerEndpoint
Parameters:
wait - - the number of milliseconds to wait
Returns:
MessageHandle - handle to the next message in the list

receiveMessages

public java.util.Vector receiveMessages(int count)
Return, at most, count messages from the cache.
Parameters:
count - - the max number of messages to receive
Returns:
Vector - number of messages

getDestination

public JmsDestination getDestination()
Description copied from class: ConsumerEndpoint
Return the destination that this consumer is subscribed to
Overrides:
getDestination in class ConsumerEndpoint
Following copied from class: org.exolab.jms.messagemgr.ConsumerEndpoint
Returns:
the destination that this consumer is subscribed to

unregister

public void unregister()
Description copied from class: ConsumerEndpoint
Unregister this consumer for the specified destination cache, so that it will stop receiving messages from it.
Overrides:
unregister in class ConsumerEndpoint

returnMessage

public void returnMessage(MessageHandle handle)
Description copied from class: ConsumerEndpoint
Return the specified message to the cache.
Overrides:
returnMessage in class ConsumerEndpoint
Following copied from class: org.exolab.jms.messagemgr.ConsumerEndpoint
Parameters:
handle - - handle to return

onMessage

public void onMessage(MessageImpl message)
Description copied from interface: QueueListener
This method is called when a new message is added to a queue cache
Specified by:
onMessage in interface QueueListener
Following copied from interface: org.exolab.jms.messagemgr.QueueListener
Parameters:
message - - message added to cache

setMessageListener

public void setMessageListener(InternalMessageListener listener)
Description copied from class: ConsumerEndpoint
Set the message listener for this consmer. If a message listener is set then messages will be scheduled to be sent to it when they are available

Each consumer cache can only have a single message listener. To remove the message listener call this method with null argument

Overrides:
setMessageListener in class ConsumerEndpoint
Following copied from class: org.exolab.jms.messagemgr.ConsumerEndpoint
Parameters:
listener - - the message listener to add.

doClose

protected void doClose()
Closes this endpoint
Overrides:
doClose in class ConsumerEndpoint


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.