org.exolab.jms.messagemgr
Class TopicConsumerEndpoint

java.lang.Object
  |
  +--org.exolab.jms.messagemgr.ConsumerEndpoint
        |
        +--org.exolab.jms.messagemgr.TopicConsumerEndpoint
All Implemented Interfaces:
DestinationCacheEventListener, DestinationEventListener, Identifiable, java.lang.Runnable, java.io.Serializable
Direct Known Subclasses:
DurableConsumerEndpoint

public class TopicConsumerEndpoint
extends ConsumerEndpoint
implements DestinationEventListener

The topic destination cache is specific to a consumer that subscribes to a topic destination.

Version:
$Revision: 1.40 $ $Date: 2003/10/21 14:41:23 $
Author:
Jim Alateras
See Also:
Serialized Form

Field Summary
protected  java.util.HashMap _caches
          Maintains a list of TopicDestinationCache that this endpoint subscribes too.
protected  JmsTopic _topic
          Cache the destination that this endpoint subscribes too
 
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
 void destinationAdded(JmsDestination destination, DestinationCache cache)
          This method is called when a new destination is added to the DestinationManager
 void destinationRemoved(JmsDestination destination, DestinationCache cache)
          This method is called when a new destination is removed from the DestinationManager
protected  void doClose()
          Closes this endpoint
 JmsDestination getDestination()
          Return the destination that this consumer is subscribed to
 boolean messageRemoved(MessageImpl message)
          This event is called when a message is removed from the DestinationCache.
 boolean persistentMessageRemoved(java.sql.Connection connection, MessageImpl message)
          This event is called when a message is removed from the DestinationCache.
 MessageHandle receiveMessage(long wait)
          Return the next message to the client.
 MessageHandle receiveNoWait()
          Returns the first available message
 void recover()
          This message will return all unacked messages to the queue and allow them to be resent to the consumer with the redelivery flag on.
 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, notifyMessageAvailable, persistentMessageAdded, removeFirstMessage, removeMessage, returnMessage, run, schedule, setAckMode, setCacheEvictionPolicy, setConnectionId, setMaximumSize, setMessageListener, setNoLocal, setSelector, setStopped, setTransacted, setWaitingForMessage, stopDelivery, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_caches

protected java.util.HashMap _caches
Maintains a list of TopicDestinationCache that this endpoint subscribes too. A wildcard subscription may point to more than one.

_topic

protected JmsTopic _topic
Cache the destination that this endpoint subscribes too
Method Detail

deliverMessages

public boolean deliverMessages()
Deliver messages in the cache to the consumer
Overrides:
deliverMessages in class ConsumerEndpoint
Returns:
true if the endpoint should be rescheduled

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

receiveNoWait

public MessageHandle receiveNoWait()
Returns the first available message

messageRemoved

public boolean messageRemoved(MessageImpl message)
Description copied from interface: DestinationCacheEventListener
This event is called when a message is removed from the DestinationCache.
Overrides:
messageRemoved in class ConsumerEndpoint
Following copied from interface: org.exolab.jms.messagemgr.DestinationCacheEventListener
Parameters:
message - - message removed from cache

persistentMessageRemoved

public boolean persistentMessageRemoved(java.sql.Connection connection,
                                        MessageImpl message)
                                 throws PersistenceException
Description copied from interface: DestinationCacheEventListener
This event is called when a message is removed from the DestinationCache.
Overrides:
persistentMessageRemoved in class ConsumerEndpoint
Following copied from interface: org.exolab.jms.messagemgr.DestinationCacheEventListener
Parameters:
connection - - the database connection
message - - message to remove from cache
Throws:
PersistenceException - - if there is a persistence related problem

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

recover

public void recover()
Description copied from class: ConsumerEndpoint
This message will return all unacked messages to the queue and allow them to be resent to the consumer with the redelivery flag on.
Overrides:
recover in class ConsumerEndpoint

destinationAdded

public void destinationAdded(JmsDestination destination,
                             DestinationCache cache)
Description copied from interface: DestinationEventListener
This method is called when a new destination is added to the DestinationManager
Specified by:
destinationAdded in interface DestinationEventListener
Following copied from interface: org.exolab.jms.messagemgr.DestinationEventListener
Parameters:
destination - - destination that was added
cache - - the corresponding cache

destinationRemoved

public void destinationRemoved(JmsDestination destination,
                               DestinationCache cache)
Description copied from interface: DestinationEventListener
This method is called when a new destination is removed from the DestinationManager
Specified by:
destinationRemoved in interface DestinationEventListener
Following copied from interface: org.exolab.jms.messagemgr.DestinationEventListener
Parameters:
destination - - destination that was removed
cache - - the corresponding cache

doClose

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


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