wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes JMS conceptual doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS conceptual doubt" Watch "JMS conceptual doubt" New topic
Author

JMS conceptual doubt

Rafael De la Guetto
Greenhorn

Joined: Jan 10, 2008
Posts: 9
Hi,

I have some conceptual doubt with the JMS server behavior.

First I register a listener in the traditional way (not needed to read it).




InitialContext jndi = new InitialContext(env);
// Look up a JMS connection factory
QueueConnectionFactory conFactory = (QueueConnectionFactory) jndi
.lookup("jms/connectionFactory");

// Create a JMS connection
QueueConnection connection = conFactory.createQueueConnection(username, password);
// Create two JMS session objects
QueueSession qSession = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
// Look up a JMS queue
Queue q = (Queue) jndi.lookup(queueName);
QueueReceiver qr = qSession.createReceiver(q);
// Set a JMS message listener
qr.setMessageListener(this);
// Start the JMS connection; allows messages to be delivered
connection.start();




Then, the listener registers to the queue without problem, the method returns, and the object wait for new messages. Until here OK.

The problem comes up when the JMS server "eventually" crashes, how can my java code get noticed about this event???

In case it doesn't get noticed, I'm forced to program a timed task that periodically checks if the connection with the queue is UP, I mean, if the object is listening for new messages, or if there has been any problem and it is no longer receiving messages.

But, how can I answer to the JMS server if a "given object" is listening on a "given queue" ???

Thanks in advance.
Ed.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JMS conceptual doubt
 
Similar Threads
JNDI setup for MyEclipse and TomCat
Duplicate JMS message processing with multiple MessageListener threads
JNDI Context problem
Queue Connection
jdeveloper look up error for jms