A ConnectionFactory object provides a template that an application uses to create a Connection object. The application uses the Connection object to create a Session object.
For C and C++, there is a single type of ConnectionFactory which has a property that enables you to select which type of protocol you want to use for a connection. For .NET, an XMS application first uses an XMSFactoryFactory object to get a reference to a ConnectionFactory object that is appropriate to the required type of protocol. This ConnectionFactory object can then only produce connections for that protocol type.
An XMS application can create multiple connections, and a multithreaded application can use a single Connection object concurrently on multiple threads.
A connection serves several purposes:
An XMS application typically creates a connection, one or more sessions, and a number of message producers and message consumers.
Creating a connection is relatively expensive in terms of system resources because it involves establishing a communications connection, and it might also involve authenticating the application.