Broker 10.15 | webMethods Broker Documentation | webMethods Broker Messaging Programmer's Guide | Coding Messaging Client Applications | A Basic JMS Sender-Receiver Client | Managing the Connection
 
Managing the Connection
After coding the necessary connection objects in your JMS client, you need to manage their state; that is, when to start and close a connection.
In JMS, when a connection is created, it is in stopped mode, meaning that no messages can be received on that connection. However, messages are able to be sent.
In this example, you need to start the connection on the receiver application so that it can receive messages. This is accomplished by calling the connection's start() method:
conn.start()
When the application will no longer use a connection, invoke the connection's close() method:
conn.close()
You should always close a connection during application cleanup whether or not a previous start() method was called on the connection.