|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.core.service.Service | +--org.exolab.core.service.BasicService | +--org.exolab.jms.messagemgr.MessageMgr
This is the active message handling component within the JMS server. Messages are passed in and added to the appropriate dispatchers for delivery to the clients.
Method Summary | |
void |
add(MessageImpl message)
Add a message to the message manager for the specified destination. |
void |
addDestination(JmsDestination destination)
Create the specified destination. |
void |
addEventListener(JmsDestination destination,
MessageManagerEventListener listener)
Add a message listener for a specific destination to be informed when messages, for the destination are added or removed from the queue. |
protected void |
addNonPersistentMessage(MessageImpl message)
This method is used to process non-persistent messages. |
protected void |
addPersistentMessage(java.sql.Connection connection,
MessageImpl message)
This method is used to process persistent messages published through the resource manager. |
protected void |
addPersistentMessage(MessageImpl message)
This method is used to process persistent messages. |
static MessageMgr |
createInstance()
Create and return an instance of the singleton. |
boolean |
exists(JmsDestination destination)
Return true if the specified destination exists. |
java.util.Iterator |
getConsumers(JmsDestination destination)
Returns an iterator of active consumers registered to a given destination |
java.util.Iterator |
getDestinations()
Returns a list of active destinations |
int |
getMaximumSize()
Return the maximum size of the cache |
void |
handleDestroyed(MessageHandle handle)
Notify the destruction of a handle. |
boolean |
hasMessages(ConsumerEndpoint consumer)
Returns true if there are any messages for the specified consumer |
static MessageMgr |
instance()
Return an instance to the MessageMgr singleton. |
void |
removeDestination(JmsDestination destination)
Remove this destination and all attached consumers. |
void |
removeEventListener(JmsDestination destination,
MessageManagerEventListener listener)
Remove the listener for the specified destination. |
JmsDestination |
resolve(java.lang.String name)
Resolves a destination given its name |
ConsumerEndpoint |
resolveConsumer(JmsDestination destination,
java.lang.String id)
Resolves a consumer given its destination and an identity. |
void |
run()
|
void |
setStopped(ConsumerEndpoint consumer,
boolean stop)
Stop/start a consumer. |
void |
start()
|
void |
stop()
|
Methods inherited from class org.exolab.core.service.BasicService |
toString |
Methods inherited from class org.exolab.core.service.Service |
getName, getState, restart, setState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public static MessageMgr createInstance() throws MessageMgrException
MessageMgrException
- public static MessageMgr instance()
createInstance()
public void start() throws org.exolab.core.service.ServiceException
start
in class org.exolab.core.service.BasicService
public void run()
run
in class org.exolab.core.service.BasicService
public void stop() throws org.exolab.core.service.ServiceException
stop
in class org.exolab.core.service.BasicService
public void addDestination(JmsDestination destination) throws javax.jms.JMSException
This can be called multiple times without any side effects. If the destination is null then it throws a JMSException
destination
- - create this destinationjavax.jms.JMSException
- - if the params is nullpublic void removeDestination(JmsDestination destination) throws javax.jms.JMSException
destination
- - the destination to removejavax.jms.JMSException
- public boolean exists(JmsDestination destination)
destination
- - destination to checkpublic void add(MessageImpl message) throws javax.jms.JMSException
If the destination, specified in the message, does not exist then create it. destinations
message
- the message to addjavax.jms.JMSException
- if the message cannot be addedprotected void addNonPersistentMessage(MessageImpl message) throws javax.jms.JMSException
message
- - the message to processjavax.jms.JMSException
- - if the message cannot be processedprotected void addPersistentMessage(MessageImpl message) throws javax.jms.JMSException
message
- - the message to processjavax.jms.JMSException
- - if the message cannot be processedprotected void addPersistentMessage(java.sql.Connection connection, MessageImpl message) throws javax.jms.JMSException
connection
- - the database connection to use.message
- - the message to processjavax.jms.JMSException
- - if the message cannot be processedpublic boolean hasMessages(ConsumerEndpoint consumer) throws javax.jms.JMSException
consumer
- - the consumer to checkjavax.jms.JMSException
- - if the consumer can't be checkedpublic java.util.Iterator getDestinations()
public java.util.Iterator getConsumers(JmsDestination destination) throws javax.jms.JMSException
ConsumerEndpoint
objects.javax.jms.JMSException
- public JmsDestination resolve(java.lang.String name)
name
- the name of the destinationpublic ConsumerEndpoint resolveConsumer(JmsDestination destination, java.lang.String id)
destination
- the destinationname
- the name of the consumerpublic void setStopped(ConsumerEndpoint consumer, boolean stop) throws javax.jms.JMSException
consumer
- the consumer to stop/startstop
- when true stop the consumer
else start it.public void addEventListener(JmsDestination destination, MessageManagerEventListener listener)
If a listener is already registered for a particuler destination then it fails silently.
destination
- - what messgaes to listen forlistener
- - a JmsMessageListener instancepublic void removeEventListener(JmsDestination destination, MessageManagerEventListener listener)
destination
- - destination that it listens forlistener
- - listener for that destination.public int getMaximumSize()
public void handleDestroyed(MessageHandle handle)
If the handle has been destroyed then we need to do the following 1. if the handle is for a queue then we can remove the message from the cache 2. if the handle is for a topic then we need to see whether we can garbage collect it
handle
- a TransientMessageHandle
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |