|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ehsbe.commons.util.jms.QueueReceiver
public class QueueReceiver
Convinience class to initially setup a message consumer. NOTE: Needs to be retrofitted to glassfish - has been developed wrt. JBOSS JNLP.
Constructor Summary | |
---|---|
QueueReceiver(InitialContext ctx,
String destination)
Create a new consumer container for a message queue. |
Method Summary | |
---|---|
void |
add(javax.jms.MessageListener l)
Add the given listener to the internal message listener list. |
void |
add(QueueEventListener l)
Add the given listener to the internal queue event listener list. |
void |
dispose()
Close everything and nullify all cached data. |
protected void |
fireMessage(javax.jms.Message msg)
Refire a message received from the JMS queue. |
protected void |
fireQueueEvent(QueueEvent e)
Fires the given event. |
String |
getClientID()
Get the ID of the client connection to the server |
void |
onException(javax.jms.JMSException exception)
Handles Receiver exceptions, like disconnect exceptions. |
void |
remove(javax.jms.MessageListener l)
Remove the given listener from the internal message listener list. |
void |
remove(QueueEventListener l)
Remove the given listener from the internal queue event listener list. |
void |
setReconnectIntervall(long millis)
Set the time to wait in milliseconds, until the receivers tries to reconnect to a topic. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueueReceiver(InitialContext ctx, String destination) throws NamingException, javax.jms.JMSException
ctx
- initial context to use for lookupsdestination
- the name of the destination queue - e.g.
"queue/foo" or "topic/bar"
NamingException
- on context lookup errors
javax.jms.JMSException
- if there are problems to create/start the
connection, session, or consumerMethod Detail |
---|
public void dispose()
public void onException(javax.jms.JMSException exception)
Informs all queue listener by sending a disconnect queue event and closes
all possibly open connections. After that, a reconnect thread is started,
which will send a connect message to queue listeners, when the connection
to the message queue has been re-established. dispose()
will
stop the re-connect thread automatically.
onException
in interface javax.jms.ExceptionListener
exception
- protected void fireQueueEvent(QueueEvent e)
e
- event to fire.protected void fireMessage(javax.jms.Message msg)
If the message contains a CrudEventList
, all events are extracted
and all QueueEventListener
notified first.
msg
- message to fire.public void setReconnectIntervall(long millis)
millis
- time in millis. If less than 1000, the default is used
instead.public void add(QueueEventListener l)
l
- listener to add.public void remove(QueueEventListener l)
l
- listener to remove.public void add(javax.jms.MessageListener l)
l
- listener to add.public void remove(javax.jms.MessageListener l)
l
- listener to remove.public String getClientID()
null
if there is no connection, the id otherwise.
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |