TopicConnectionFactory administered objects

 

In the example, the TopicConnectionFactory object is obtained from JNDI name space. The TopicConnectionFactory in this case is an administered object that has been created and administered using the JMSAdmin tool. Use this method of obtaining TopicConnectionFactory objects because it ensures code portability.

The TopicConnectionFactory in the example is testTCF in JMSAdmin. Create testTCF in JMSAdmin before running the application. You must also create a Topic in JMSAdmin; see Topic administered objects.

To create a TopicConnectionFactory object, invoke the JMSAdmin tool, as described in Invoking the administration tool, and execute one of the following commands, depending on the type of connection you want to make to the broker:

Bindings connection

InitCtx> def tcf(testTCF) transport(bind)
or, because this is the default transport type for TopicConnectionFactory objects:
InitCtx> def tcf(testTCF)
This creates a TopicConnectionFactory with default settings for bindings transport, connecting to the default queue manager.

Client connection

InitCtx> def tcf(testTCF) transport(client)
This creates a TopicConnectionFactory with default settings for the client transport type, connecting to localhost, on port 1414, using channel SYSTEM.DEF.SVRCONN.

Direct TCP/IP connection to a broker

InitCtx> def tcf(testTCF) transport(direct)
This creates a TopicConnectionFactory to make direct connections to a broker, connecting to localhost on port 1506.


uj24720_