Hi forum: I'm looking for a best-of practice here. If I have a very simple remote (not inside the j2ee server) jms client waiting for publications to a queue or topic, the client just sits there waiting. If the j2ee server is restarted, the client still just sits there. How can the client determine that the j2ee server has been restarted so it can re-connect itself? Thanks, Mike
Java EE Evangelist — Author, EJB 3 in Action 2nd Edition — Java Community Process Member
If you want to check whether the JMS (actually Message queue) server is up, you can periodically lookup for the connecting factory in the directory server, if the factory is not bound you get a NamingException with a specific message, If you don't get that exception + message the JMS server might be up. But I am not sure whether the JNDI objects (like connection factory, destination) are unbound when the JMS server is shutdown, if not you can do an additional check when you create the respective connection objects.