A Connection object encapsulates a virtual connection with the server. ConnectionFactory objects create Connection objects. You use a Connection to create one or more Session objects. For example, using the myConnectionFactory
object created in ConnectionFactory, the following creates a Connection:
A connection is a fairly heavyweight object, and therefore most clients will use one connection for all messaging. You may create multiple connections, if needed by your application.
Before consuming messages, the application must call the start()
method on the connection. See MessageConsumer for more details about MessageConsumers. If you wish to temporarily suspend message delivery, call the stop()
method on the connection.
When a client application completes, all open connections must be closed. Unused open connections are eventually closed, but they do consume resources that could be used for other applications. Closing a connection also closes any Sessions created by the Connection. To close a connection, use the close()
method. For example:
TIBCO Enterprise Message Service™ User’s Guide Software Release 4.3, February 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |