Reference: Creating a JMS example
Warning Please note that JMS connections, sessions, producers and consumers are designed to be re-used. It's an anti-pattern to create new connections, sessions, producers and consumers for each message you produce or consume. If you do this, your application will perform very poorly. This is discussed further in the section on performance tuning Chapter 46, Performance Tuning.