blob: a2bb5ddf0084116e69d5afb39f88359bd228d703 [file] [log] [blame]
<div class="docbook"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">5.2.&#160;ConnectionFactory</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="JMS-Client-0-8-Client-Understanding.html">Prev</a>&#160;</td><th align="center" width="60%">Chapter&#160;5.&#160;Understanding the Client</th><td align="right" width="20%">&#160;<a accesskey="n" href="JMS-Client-0-8-Client-Understanding-Connection.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="JMS-Client-0-8-Client-Understanding-ConnectionFactory"></a>5.2.&#160;ConnectionFactory</h2></div></div></div><p>A <a class="link" href="http://docs.oracle.com/javaee/6/api/javax/jms/ConnectionFactory.html" target="_top">ConnectionFactory</a>
allows an application to create a <a class="link" href="http://docs.oracle.com/javaee/6/api/javax/jms/Connection.html" target="_top">Connection</a>.</p><p>The application obtains the ConnectionFactory from an <a class="link" href="http://docs.oracle.com/javaee/6/api/javax/naming/InitialContext.html" target="_top">InitialContext</a>. The
InitialContext is itself obtained from an InitialContextFactory. </p><p>The Client provides a single implementation of the InitialContextFactory in class
<code class="literal">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</code>. This
implementation is backed by a <a class="link" href="http://docs.oracle.com/javaee/6/api/java/util/Properties.html" target="_top">Properties</a> object which can of course be loaded from an external properties file,
or created programatically.</p><p>The examples in the previous chapter illustrated the Java code required to <a class="link" href="JMS-Client-0-8-Examples.html#JMS-Client-0-8-Examples-PTP" title="4.1.&#160;Point to point example">create the InitialContext</a> and an <a class="link" href="JMS-Client-0-8-Examples.html#JMS-Client-0-8-Examples-PTP-PropertiesFile" title="Example&#160;4.2.&#160;JMS Example - Point to Point Messaging - JNDI Properties">example properties file</a>.</p><p>The Client also provides an alternate connection factory implementation providing a
connection pool. This can be useful when utilsing frameworks such as Spring.
<a class="xref" href="JMS-Client-0-8-Appendix-PooledConnecytionFactory.html" title="Appendix&#160;D.&#160;PooledConnectionFactory">Appendix&#160;D, <em>PooledConnectionFactory</em></a>.</p><div class="figure"><a id="d0e375"></a><p class="title"><strong>Figure&#160;5.2.&#160;JNDI overview</strong></p><div class="figure-contents"><div class="mediaobject"><img alt="JNDI overview" src="images/JndiOverview.png" /></div></div></div><br class="figure-break" /><p>Note that the Apache Qpid Broker-J does not present a JNDI interface to the application.</p></div><div class="navfooter"><hr /><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="JMS-Client-0-8-Client-Understanding.html">Prev</a>&#160;</td><td align="center" width="20%"><a accesskey="u" href="JMS-Client-0-8-Client-Understanding.html">Up</a></td><td align="right" width="40%">&#160;<a accesskey="n" href="JMS-Client-0-8-Client-Understanding-Connection.html">Next</a></td></tr><tr><td align="left" valign="top" width="40%">Chapter&#160;5.&#160;Understanding the Client&#160;</td><td align="center" width="20%"><a accesskey="h" href="JMS-Client-Book.html">Home</a></td><td align="right" valign="top" width="40%">&#160;5.3.&#160;Connection</td></tr></table></div></div>