|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jrun.jms.core.messagemgr.ConsumerEndpoint
A Consumer is a message subscriber with a unique identity
| Field Summary | |
protected int |
_ackMode
The acknowledgement mode for this endpoint. |
protected int |
_connectionId
Holds the connection id of the connection that the endpoint belongs too |
protected boolean |
_destroyed
Identifies this endpoint as being destroyed. |
protected InternalMessageListener |
_listener
Holds the consumer's message listener. |
protected MessageQueue |
_messages
Transient cache of all messages waiting to be sent to the consumer. |
protected boolean |
_nolocal
The nolocal indicator, if set, inhibits consuming messages that have been published on the same connection |
protected boolean |
_scheduled
Indicates whether the this cache has been scheduled with the dispatcher for asynchronous message delivery. |
protected Scheduler |
_scheduler
This is the scheduler that is used to deliver messages if a consumer has a registered listener |
protected JMSSelector |
_selector
The selector assoicated with this consumer. |
protected JmsServerSession |
_session
caches the session that created this endpoint |
protected int |
_size
Maintains the maximum size of this cache |
protected boolean |
_stopped
This determines whether message delivery to the registered listener is enabled or disabled. |
protected boolean |
_transacted
Indicates whether this endpoint belongs to a transacted session |
| Method Summary | |
abstract boolean |
canGarbageCollect(MessageHandle handle)
Check if this message is referenced by this endpoint. |
protected void |
clearMessages()
Clear all messages in the cache, regardless of whether they are persistent or non-persistent |
void |
destroy()
Destroy this object |
int |
getAckMode()
Return the ackmode for this endpoint |
long |
getClientId()
Return a reference to the client identity. |
int |
getConnectionId()
Return the connection id that this endpoint belongs too |
abstract JmsDestination |
getDestination()
Return the destination that this consumer is subscribed too |
long |
getId()
Return the identity of the object as a long |
java.lang.String |
getIdAsString()
Return the identity of the object as a string |
protected Logger |
getLogger()
Return a reference to the logger |
int |
getMaximumSize()
Return the cache's maximum size |
int |
getMessageCount()
Return the number of unsent messages in the cache for this consumer |
boolean |
getNoLocal()
Return the value of the nolocal indicator |
JMSSelector |
getSelector()
Return the selector for this endpoint or null if one is not specified |
JmsServerSession |
getSession()
Return a reference to the session owning this endpoint |
boolean |
getTransacted()
Check whether this endpoint belongs to a transacted session |
int |
getUnprocessedMessageCount()
Return the number of unsent and unacked messages for this consumer |
int |
getUnsentMessages()
Return the number of unsent messages |
int |
hashCode()
|
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(MessageImpl message)
This event is called when a persistent message is added to the DestinationCache. |
boolean |
persistentMessageRemoved(MessageImpl message)
This event is called when a message is removed from the DestinationCache. |
abstract MessageHandle |
receiveMessage()
Return the next message to the client. |
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. |
protected void |
schedule()
Schedule asynchronouse message delivery |
void |
setAckMode(int ackmode)
Set the ackMode for this endpoint |
void |
setCacheEvictionPolicy(CacheEvictionPolicy policy)
Set the #CacheEvictionPolicy for this object. |
void |
setClientId(long id)
Set the client identity for this identity |
void |
setConnectionId(int id)
Set the connection that this endpooint belongs too |
void |
setMaximumSize(int size)
Set the maximum size of the cache. |
void |
setMessageListener(InternalMessageListener listener)
Set the message listener for this consmer. |
void |
setNoLocal(boolean nolocal)
Set the no local indicator for this endpoint |
void |
setSelector(java.lang.String selector)
Set the selector for this endpoint |
void |
setStopped(boolean stop)
Start or stop message delivery |
void |
setTransacted(boolean transacted)
Set the state if the transacted flag for this endpoint |
void |
shutdown()
Close the cache and unregister all the consumers. |
void |
startMessageDelivery()
Start delivering messages to the registered listener |
void |
stopMessageDelivery()
Stop delivering messages to the registered listener |
java.lang.String |
toString()
Return a stringified version of the consumer |
abstract void |
unregister()
Unregister this consumer for the specified destination cache, so that it will stop receiving messages from it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.lang.Runnable |
run |
| Field Detail |
protected JMSSelector _selector
protected MessageQueue _messages
protected InternalMessageListener _listener
protected int _size
protected transient boolean _stopped
protected transient boolean _destroyed
protected transient Scheduler _scheduler
protected transient boolean _scheduled
protected transient int _ackMode
protected transient boolean _nolocal
protected transient boolean _transacted
protected transient int _connectionId
protected JmsServerSession _session
| Method Detail |
public abstract JmsDestination getDestination()
public long getId()
IdentifiablegetId in interface Identifiablejrun.jms.core.Identifiablepublic java.lang.String getIdAsString()
IdentifiablegetIdAsString in interface Identifiablejrun.jms.core.Identifiablepublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic abstract void unregister()
public long getClientId()
public void setClientId(long id)
id - - the client identitypublic JMSSelector getSelector()
public void setSelector(java.lang.String selector)
throws javax.jms.InvalidSelectorException
selector - - message selector as a stringInvalidSelectorException - - raised when selector is not
well-formedpublic int getAckMode()
public void setAckMode(int ackmode)
ackmode - - the new ack mode for the endpointpublic int getConnectionId()
public void setConnectionId(int id)
id - - connection identitypublic boolean getNoLocal()
public void setNoLocal(boolean nolocal)
nolocal - - true to inhibit messages published on this connectionpublic boolean getTransacted()
public void setTransacted(boolean transacted)
transacted - - true if it is transactedpublic void setMaximumSize(int size)
CacheEvictionPolicy is enforced
to remove messages.size - - maximum number of messages a destination can holdpublic int getMaximumSize()
public int getUnsentMessages()
public void setCacheEvictionPolicy(CacheEvictionPolicy policy)
#CacheEvictionPolicy for this object. This determines
how messages are removed when the cache's upper limit is reached. If no
policy is specified then the default #LifoEvictionPolicy is
applied.policy - - cache's eviction policypublic int getMessageCount()
public JmsServerSession getSession()
public boolean messageAdded(MessageImpl message)
DestinationCacheEventListenermessageAdded in interface DestinationCacheEventListenerjrun.jms.core.messagemgr.DestinationCacheEventListenermessage - - message added to cachepublic boolean messageRemoved(MessageImpl message)
DestinationCacheEventListenermessageRemoved in interface DestinationCacheEventListenerjrun.jms.core.messagemgr.DestinationCacheEventListenermessage - - message removed from cache
public boolean persistentMessageAdded(MessageImpl message)
throws PersistenceException
DestinationCacheEventListenerpersistentMessageAdded in interface DestinationCacheEventListenerjrun.jms.core.messagemgr.DestinationCacheEventListenerconnection - - the database connectionmessage - - message added to cachePersistenceException - - if there is a persistence related problem
public boolean persistentMessageRemoved(MessageImpl message)
throws PersistenceException
DestinationCacheEventListenerpersistentMessageRemoved in interface DestinationCacheEventListenerjrun.jms.core.messagemgr.DestinationCacheEventListenerconnection - - the database connectionmessage - - message to remove from cachePersistenceException - - if there is a persistence related problempublic void recover()
public void destroy()
public void setMessageListener(InternalMessageListener listener)
Each consumer cache can only have a single message listener. To remove the message listener call this method with null argument
listener - - the message listener to add.public abstract MessageHandle receiveMessage()
public abstract boolean canGarbageCollect(MessageHandle handle)
handle - - message to checkpublic void shutdown()
Once the cache is closed it will no longger receive messages for this destination.
public void startMessageDelivery()
public void stopMessageDelivery()
protected Logger getLogger()
protected void schedule()
public void setStopped(boolean stop)
stop - - true to stop message delivery; false to start itpublic int getUnprocessedMessageCount()
protected void clearMessages()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||