org.exolab.jms.messagemgr
Class QueueConsumerEndpoint

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

public class QueueConsumerEndpoint
extends ConsumerEndpoint

A QueueConsumerEndpoint extends ConsumerEndpoint. This object shares access to a particular queue with other QueueConsumerEndpoint instances.

Version:
$Revision: 1.35 $ $Date: 2003/08/17 01:32:24 $
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
 int getMessageCount()
          Return the number of unsent messages
 boolean hasMessageListener()
          Check whether a listener has been registered with this endpoint to support async message delivery
 boolean messageAdded(MessageImpl message)
          This event is called when a non-persistent message is added to the DestinationCache.
 boolean messageRemoved(MessageImpl message)
          This event is called when a message is removed from the DestinationCache.
 boolean persistentMessageAdded(java.sql.Connection connection, MessageImpl message)
          This event is called when a persistent message is added to the DestinationCache.
 MessageHandle receiveMessage(long wait)
          Return the next message to the client.
 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, getNoLocal, getPersistentId, getSelector, getSession, getTransacted, hashCode, isStopped, isWaitingForMessage, notifyMessageAvailable, persistentMessageRemoved, recover, removeFirstMessage, removeMessage, returnMessage, 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

getMessageCount

public int getMessageCount()
Return the number of unsent messages
Overrides:
getMessageCount in class ConsumerEndpoint
Returns:
the number of unsent messages

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

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.

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

hasMessageListener

public boolean hasMessageListener()
Check whether a listener has been registered with this endpoint to support async message delivery
Returns:
boolean - true if it has

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

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

messageAdded

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

persistentMessageAdded

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

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

doClose

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


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