Menu Search

5.2. ConnectionFactory

A ConnectionFactory allows an application to create a Connection.

The application obtains the ConnectionFactory from an InitialContext. The InitialContext is itself obtained from an InitialContextFactory.

The Client provides a single implementation of the InitialContextFactory in class org.apache.qpid.jndi.PropertiesFileInitialContextFactory. This implementation is backed by a Properties object which can of course be loaded from an external properties file, or created programatically.

The examples in the previous chapter illustrated the Java code required to create the InitialContext and an example properties file.

The Client also provides an alternate connection factory implementation providing a connection pool. This can be useful when utilsing frameworks such as Spring. Appendix D, PooledConnectionFactory.

Figure 5.2. JNDI overview

JNDI overview

Note that the Apache Qpid Broker-J does not present a JNDI interface to the application.