|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.exolab.jms.messagemgr.ConsumerManager
The consumer manager is responsible for creating and managing the lifecycle of Consumer. The consumer manager maintains a list of all active consumers.
The consumer manager, in an attempt to make better utilization of resource will also act as a proxy for all inactive durable subscribers So it will act as a DestinationCacheEventListener and process the message on behalf of the inactive consumer.
| Method Summary | |
void |
cleanUnreferencedEndpoints(JmsDestination dest)
Clean all the unreferenced endpoints for a specified destination. |
void |
collectGarbage(boolean aggressive)
Perform any garbage collection on this resource. |
java.util.Iterator |
consumerEndpoints()
Return a list of ConsumerEndpoint objects, both transient and
durable that are currently active. |
java.util.Iterator |
consumerIds()
Return a list of consumer names id's currently active in the consumer manager. |
ConsumerEndpoint |
createConsumerEndpoint(JmsServerSession session,
long clientId,
JmsDestination destination,
java.lang.String selector)
Create a transient consumer for the specified destination. |
void |
createDurableConsumer(JmsTopic topic,
java.lang.String name)
This method creates an actual durable consumer for the specified and caches it. |
DurableConsumerEndpoint |
createDurableConsumerEndpoint(JmsServerSession session,
JmsTopic topic,
java.lang.String name,
long clientId,
java.lang.String selector)
Create a durable consumer with the specified well-known name. |
static ConsumerManager |
createInstance()
Create the singleton instance of the consumer manager |
ConsumerEndpoint |
createQueueBrowserEndpoint(JmsServerSession session,
long clientId,
JmsQueue queue,
java.lang.String selector)
Create a browser for the specified destination and the selector. |
void |
deleteConsumerEndpoint(ConsumerEndpoint consumer)
Destroy the specified consumer |
void |
deleteDurableConsumerEndpoint(java.lang.String name)
Destroy the endpoint associated with the specified durable consumer |
void |
destroy()
Destroy this manager. |
boolean |
durableConsumerExists(java.lang.String name)
Check if the specified durable consumer exists |
boolean |
exists(java.lang.String id)
Check whether a consumer, with the specified identity actually exists. |
ConsumerEndpoint |
getConsumerEndpoint(java.lang.String id)
Return the consumer with the specified identity |
JmsDestination |
getDestinationForConsumerName(java.lang.String name)
Return the destination assoicated with the specified durable consumer. |
java.util.Vector |
getDurableConsumersForDest(JmsTopic dest)
Return a list of durable subscribers for the specified destination |
java.util.LinkedList |
getEndpointsForDest(JmsDestination dest)
Return a list of ConsumerEndpoint objects attached to the
specified destination |
boolean |
hasActiveConsumers(JmsDestination destination)
Check whether there is an active consumer for the specified destination |
boolean |
hasActiveDurableConsumers(JmsDestination topic)
Check whether there are active durable consumers for the specified destination. |
static ConsumerManager |
instance()
Return the singleton instance of the ConsumerManager |
boolean |
isDurableConsumerActive(java.lang.String name)
Check whether a particular durable consumer is active |
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. |
boolean |
persistentMessageRemoved(java.sql.Connection connection,
MessageImpl message)
This event is called when a message is removed from the DestinationCache. |
void |
removeDurableConsumer(java.lang.String name)
This method will remove the durable consumer from the database and from transient memory only if it exists and is inactive. |
void |
removeDurableConsumers(JmsDestination topic)
This method will remove all the durable consumers from the database and from transient memory whether they are active or not. |
boolean |
validSubscription(java.lang.String topic,
java.lang.String name)
This method will check that the name-destination pair actually are valid and exist as a DurableConsumer entity |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static ConsumerManager createInstance()
throws org.exolab.core.service.ServiceException
org.exolab.core.service.ServiceException - if the service cannot be initialisedpublic static ConsumerManager instance()
public void createDurableConsumer(JmsTopic topic,
java.lang.String name)
throws javax.jms.JMSException
topic - - the topic destinationname - - the consumer namejavax.jms.JMSException - - if it cannot be created
public void removeDurableConsumer(java.lang.String name)
throws javax.jms.JMSException
If the durable consumer does not exist then an exception is also raised.
name - - the consumer namejavax.jms.JMSException - - if it cannot be removed
public void removeDurableConsumers(JmsDestination topic)
throws javax.jms.JMSException
If we have problems removing the durable consumers then throw the JMSException.
topic - the topic to remove consumers for
public ConsumerEndpoint createConsumerEndpoint(JmsServerSession session,
long clientId,
JmsDestination destination,
java.lang.String selector)
throws javax.jms.JMSException,
javax.jms.InvalidSelectorException
The clientId parameter is used to indirectly reference the remote client which is uniquely identifiable within a session and is used during asynchronous message delivery.
clientId - - indirect reference to the remote clientdestination - - consumer for this destinationselector - - the consumer's selector if specified.
public DurableConsumerEndpoint createDurableConsumerEndpoint(JmsServerSession session,
JmsTopic topic,
java.lang.String name,
long clientId,
java.lang.String selector)
throws javax.jms.JMSException
session - the owning sessiontopic - consumer for this topicname - the unique subscriber nameclientId - the remote client identityselector - the message selector. May be nulljavax.jms.JMSException - if a durable consumer is already active with
the same name, or the topic doesn't exist,
or selector is an invalid selectorpublic boolean hasActiveDurableConsumers(JmsDestination topic)
topic - the destination to checktrue - if there is at least one active consumer
public ConsumerEndpoint createQueueBrowserEndpoint(JmsServerSession session,
long clientId,
JmsQueue queue,
java.lang.String selector)
throws javax.jms.JMSException
session - the owning sessionclientId - the remote client identity, which is session scopedqueue - the queue destination cacheselector - optional filter
public void deleteDurableConsumerEndpoint(java.lang.String name)
throws javax.jms.JMSException
name - - name of the durable consumerjavax.jms.JMSException - - if itt cannot complete the requestpublic void deleteConsumerEndpoint(ConsumerEndpoint consumer)
consumer - the consumer to destroypublic ConsumerEndpoint getConsumerEndpoint(java.lang.String id)
id - - identity of the consumerpublic java.util.Iterator consumerEndpoints()
ConsumerEndpoint objects, both transient and
durable that are currently active.ConsumerEndpoint objectspublic java.util.Iterator consumerIds()
public boolean exists(java.lang.String id)
id - - identity of the consumer
public boolean hasActiveConsumers(JmsDestination destination)
throws javax.jms.JMSException
destination - - the destination to checkpublic boolean isDurableConsumerActive(java.lang.String name)
name - - the consumer namepublic JmsDestination getDestinationForConsumerName(java.lang.String name)
name - - consumer namepublic boolean durableConsumerExists(java.lang.String name)
name - - the name of the durable consumer
public boolean validSubscription(java.lang.String topic,
java.lang.String name)
topic - - the name of the topicname - - the name of the durable consumerpublic boolean messageAdded(MessageImpl message)
DestinationCacheEventListenermessageAdded in interface DestinationCacheEventListenerorg.exolab.jms.messagemgr.DestinationCacheEventListenermessage - - message added to cachepublic boolean messageRemoved(MessageImpl message)
DestinationCacheEventListenermessageRemoved in interface DestinationCacheEventListenerorg.exolab.jms.messagemgr.DestinationCacheEventListenermessage - - message removed from cache
public boolean persistentMessageAdded(java.sql.Connection connection,
MessageImpl message)
throws PersistenceException
DestinationCacheEventListenerpersistentMessageAdded in interface DestinationCacheEventListenerorg.exolab.jms.messagemgr.DestinationCacheEventListenerconnection - - the database connectionmessage - - message added to cachePersistenceException - - if there is a persistence related problem
public boolean persistentMessageRemoved(java.sql.Connection connection,
MessageImpl message)
throws PersistenceException
DestinationCacheEventListenerpersistentMessageRemoved in interface DestinationCacheEventListenerorg.exolab.jms.messagemgr.DestinationCacheEventListenerconnection - - the database connectionmessage - - message to remove from cachePersistenceException - - if there is a persistence related problempublic void destroy()
public java.util.Vector getDurableConsumersForDest(JmsTopic dest)
public void cleanUnreferencedEndpoints(JmsDestination dest)
dest- - the destination to querypublic java.util.LinkedList getEndpointsForDest(JmsDestination dest)
ConsumerEndpoint objects attached to the
specified destinationdest - the destination to querypublic void collectGarbage(boolean aggressive)
GarbageCollectablecollectGarbage in interface GarbageCollectableorg.exolab.jms.gc.GarbageCollectableaggressive - - true for aggressive garbage collection
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||