|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.service.Service | +--org.exolab.jms.messagemgr.ConsumerManagerImpl
The consumer manager is responsible for creating and managing the lifecycle of consumers. The consumer manager maintains a list of all active consumers.
Constructor Summary | |
ConsumerManagerImpl(DestinationManager destinations,
DatabaseService database)
Construct a new ConsumerManager . |
Method Summary | |
void |
closeConsumer(ConsumerEndpoint consumer)
Close a consumer. |
ConsumerEndpoint |
createConsumer(JmsDestination destination,
long connectionId,
java.lang.String selector,
boolean noLocal)
Create a transient consumer for the specified destination. |
DurableConsumerEndpoint |
createDurableConsumer(JmsTopic topic,
java.lang.String name,
java.lang.String clientID,
long connectionId,
boolean noLocal,
java.lang.String selector)
Create a durable consumer. |
ConsumerEndpoint |
createQueueBrowser(JmsQueue queue,
java.lang.String selector)
Create a browser for the specified destination and the selector. |
protected void |
doStart()
Start the service. |
protected void |
doStop()
Stop the service. |
ConsumerEndpoint |
getConsumerEndpoint(long consumerId)
Return the consumer with the specified identity. |
ConsumerEndpoint |
getConsumerEndpoint(java.lang.String persistentId)
Return the consumer with the specified persistent identity. |
boolean |
hasActiveConsumers(JmsDestination destination)
Determines if there are any active consumers for a destination. |
void |
subscribe(JmsTopic topic,
java.lang.String name,
java.lang.String clientID)
Create a new durable subscription. |
void |
unsubscribe(JmsTopic topic)
Remove all durable subscriptions for a destination. |
void |
unsubscribe(java.lang.String name,
java.lang.String clientID)
Remove a durable subscription. |
Methods inherited from class org.exolab.jms.service.Service |
getName, isStarted, restart, start, stop, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConsumerManagerImpl(DestinationManager destinations, DatabaseService database)
ConsumerManager
.destinations
- the destination managerdatabase
- the database serviceMethod Detail |
public void subscribe(JmsTopic topic, java.lang.String name, java.lang.String clientID) throws javax.jms.JMSException
subscribe
in interface ConsumerManager
topic
- the topic to subscribe toname
- the subscription nameclientID
- the client identifier. May be null
javax.jms.InvalidDestinationException
- if topic
is not a
persistent destination, or
name
is an invalid
subscription namejavax.jms.JMSException
- if the durable consumer can't be
createdpublic void unsubscribe(java.lang.String name, java.lang.String clientID) throws javax.jms.JMSException
DurableConsumerEndpoint
is inactive.unsubscribe
in interface ConsumerManager
name
- the subscription nameclientID
- the client identifier. May be null
javax.jms.InvalidDestinationException
- if an invalid subscription name is
specified.javax.jms.JMSException
- if the durable consumer is active, or
cannot be removedpublic void unsubscribe(JmsTopic topic) throws javax.jms.JMSException
ConsumerEndpoint
s are inactive.unsubscribe
in interface ConsumerManager
topic
- the topic to remove consumers forjavax.jms.JMSException
- if the subscriptions can't be removedpublic ConsumerEndpoint createConsumer(JmsDestination destination, long connectionId, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException, javax.jms.InvalidSelectorException
createConsumer
in interface ConsumerManager
destination
- the destination to consume messages fromconnectionId
- the identity of the connection that owns this
consumerselector
- the message selector. May be null
noLocal
- if true, and the destination is a topic, inhibits the
delivery of messages published by its own connection.
The behavior for noLocal
is not
specified if the destination is a queue.public DurableConsumerEndpoint createDurableConsumer(JmsTopic topic, java.lang.String name, java.lang.String clientID, long connectionId, boolean noLocal, java.lang.String selector) throws javax.jms.JMSException
createDurableConsumer
in interface ConsumerManager
topic
- the topic to subscribe toname
- the subscription nameclientID
- the client identifier. May be null
.connectionId
- the identity of the connection that owns this
consumernoLocal
- if true, and the destination is a topic, inhibits the
delivery of messages published by its own
connection.selector
- the message selector. May be null
javax.jms.InvalidDestinationException
- if topic
is not a
persistent destinationjavax.jms.InvalidSelectorException
- if the selector is not well formedjavax.jms.JMSException
- if a durable consumer is already
active with the same name
public ConsumerEndpoint createQueueBrowser(JmsQueue queue, java.lang.String selector) throws javax.jms.JMSException
createQueueBrowser
in interface ConsumerManager
queue
- the queue to browseselector
- the message selector. May be null
javax.jms.JMSException
- if the browser can't be createdpublic void closeConsumer(ConsumerEndpoint consumer)
closeConsumer
in interface ConsumerManager
consumer
- the consumer to closepublic ConsumerEndpoint getConsumerEndpoint(long consumerId)
getConsumerEndpoint
in interface ConsumerManager
consumerId
- the identity of the consumernull
if none existspublic ConsumerEndpoint getConsumerEndpoint(java.lang.String persistentId)
getConsumerEndpoint
in interface ConsumerManager
persistentId
- the persistent identity of the consumernull
if none existspublic boolean hasActiveConsumers(JmsDestination destination)
hasActiveConsumers
in interface ConsumerManager
destination
- the destinationtrue
if there is at least one consumerprotected void doStart() throws ServiceException
doStart
in class Service
ServiceException
- if the service fails to startprotected void doStop()
doStop
in class Service
org.exolab.jms.service.Service
ServiceException
- if the service fails to stop
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |