A client uses a connection factory object (ConnectionFactory) to create a connection. A connection object ( Connection) represents a client’s active connection to the broker. It uses the underlying Message Queue connection service that is either started by default or is explicitly started by the administrator for this client.
Both allocation of communication resources and authentication of the client take place when a connection is created. It is a relatively heavyweight object, and most clients do all their messaging with a single connection. Connections support concurrent use: any number of producers and consumers can share a connection.
When you create a connection factory, you can configure the behavior of all connections derived from it by setting its properties. For Message Queue, these specify the following information:
The name of the host on which the broker resides, the connection service desired, and the port through which the client is to access that service.
How automatic reconnection to the broker should be handled if the connection fails. This feature reconnects the client to the same (or, in a broker cluster, to a different broker) if a connection is lost.
The default name and password of any user attempting the connection. This information is used to authenticate the user and authorize operations if a password is not specified at connection time.
How to manage the flow of control and payload messages between the broker and the client runtime.
It is possible to override connection factory properties from the command line used to start the client application. It is also possible to override properties for any given connection by explicitly setting properties for that connection.
You can use a connection object to create session objects, to set up an exception listener, or to obtain JMS version and JMS provider information.