I'm working on a simple Java SE client which acts as a JMS message producer. The application isn't very complicated but I have doubts regarding JMS resource handling in a standalone application.
Of course I want to use or re-use resources like Connections as efficient as possible. On the other hand the application should be as robust as possible regarding network or broker failures.
What are your best practices? For example should I reuse a single JMS Connection as long as possible? Or is it more robuts to create a new Connection each time the client wants to send a message? What are good ways to deal with network or broker failures? Do you think it would be a good idea to use an embeddable broker (like ActiveMQ) which is used for persistent message queueing inside the application itself?
This won't be an application with high throughput. As it will be running as a daemon it's more important to create an application that prevents resource bottlenecks and can deal with situations where the broker (or application server) is gone or the network connection between the application and the broker is down.