jrun.jms.core.messagemgr
Class QueueBrowserEndpoint

java.lang.Object
  |
  +--jrun.jms.core.messagemgr.ConsumerEndpoint
        |
        +--jrun.jms.core.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.15 $ $Date: 2001/10/12 07:55:31 $
Author:
Jim Alateras
See Also:
Serialized Form

Fields inherited from class jrun.jms.core.messagemgr.ConsumerEndpoint
_ackMode, _connectionId, _destroyed, _listener, _messages, _nolocal, _scheduled, _scheduler, _selector, _session, _size, _stopped, _transacted
 
Method Summary
 boolean canGarbageCollect(MessageHandle handle)
          Check if this message is referenced by this endpoint.
 void destroy()
          Destroy this object
 JmsDestination getDestination()
          Return the destination that this consumer is subscribed too
 void onMessage(MessageImpl message)
          This method is called when a new message is added to a queue cache
 MessageHandle receiveMessage()
          Return the next message to the client.
 java.util.Vector receiveMessages(int count)
          Return, at most, count messages from the cache.
 void run()
          The run method is used to asynchronously deliver the messages in the cache to the consumer.
 void setLastMessageProcessed(long id)
           
 void setMessageListener(InternalMessageListener listener)
          Set the message listener for this consmer.
 void stopMessageDelivery()
          Stop delivering messages to the registered listener
 void unregister()
          Unregister this consumer for the specified destination cache, so that it will stop receiving messages from it.
 
Methods inherited from class jrun.jms.core.messagemgr.ConsumerEndpoint
clearMessages, getAckMode, getClientId, getConnectionId, getId, getIdAsString, getLogger, getMaximumSize, getMessageCount, getNoLocal, getSelector, getSession, getTransacted, getUnprocessedMessageCount, getUnsentMessages, hashCode, messageAdded, messageRemoved, persistentMessageAdded, persistentMessageRemoved, recover, schedule, setAckMode, setCacheEvictionPolicy, setClientId, setConnectionId, setMaximumSize, setNoLocal, setSelector, setStopped, setTransacted, shutdown, startMessageDelivery, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

run

public void run()
The run method is used to asynchronously deliver the messages in the cache to the consumer. It is scheduler by the Scheduler.

The thread, assigned by the scheduler, will attempt to deliver all the messages in the cache and then terminate. In addition this method must be prepared to be interrupted.


receiveMessage

public MessageHandle receiveMessage()
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: jrun.jms.core.messagemgr.ConsumerEndpoint
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 too
Overrides:
getDestination in class ConsumerEndpoint
Following copied from class: jrun.jms.core.messagemgr.ConsumerEndpoint
Returns:
JmsDestination

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

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: jrun.jms.core.messagemgr.QueueListener
Parameters:
message - - message added to cache

setLastMessageProcessed

public void setLastMessageProcessed(long id)

canGarbageCollect

public boolean canGarbageCollect(MessageHandle handle)
Description copied from class: ConsumerEndpoint
Check if this message is referenced by this endpoint. If it is then the message cannot be garbage collected.
Overrides:
canGarbageCollect in class ConsumerEndpoint
Following copied from class: jrun.jms.core.messagemgr.ConsumerEndpoint
Parameters:
handle - - message to check
Returns:
boolean - true if we can garbage collect

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: jrun.jms.core.messagemgr.ConsumerEndpoint
Parameters:
listener - - the message listener to add.

destroy

public void destroy()
Destroy this object
Overrides:
destroy in class ConsumerEndpoint

stopMessageDelivery

public void stopMessageDelivery()
Description copied from class: ConsumerEndpoint
Stop delivering messages to the registered listener
Overrides:
stopMessageDelivery in class ConsumerEndpoint


Copyright � 2002 Macromedia Corporation. All Rights Reserved.