Where is the isOpen()/isClosed() on javax.jms.Connection
I mean really, why doesn't the JMS spec dictate that there is a programatical way to determine if a JMS Connection is open or connected?
I have built a JMSBroker to handle all the internal JMS stuff to create connections and get access to Queue's and Topics, but the biggest issue I have to deal with is reconnection.
It seem that we often have connection issues to the JMS Server, and so want to have the underlying JMS client side layer automatically handle this and retry the message. To do this I have to use the following logic.
Build the Packet,
Try to send it,
If that works YAY packet out.
Otherwise...
work out what failed,
- which could be either the connection or the session.
- Theres no way to know except which method call failed, so the try catch loops have to be tight with error handling in multiple places.
- Re-connect each of the broken bits, and go back to the start.
Would it be much nicer to do:
- getConnection() - checks if cached connection is open, if so returns, else creates a new one and returns.
- getSesison() - checks if cached session is open, if so returns it else calls getConnection().createXXXSession()
- Message uses session to send out..
Now isn't that cleaner...
I think so.

