4. JNDI Administered Objects

JMS administered objects encapsulate specific behavior so you can write producer and consumer applications without the use of specific constructions. Your applications can use JNDI to look up LBMConnectionFactory and Destination objects. The LBMConnectionFactory encapsulates all of the UM configuration properties for the selected JNDI object and also creates and initializes the UM Context.

4.1. Look Up Administered Objects Using JNDI

The code below shows the typical steps to create an initial context and look up a ConnectionFactory and a Destination using JNDI. The JNDI repository used depends on the values used for providerContextFactory and providerUrl and would typically need to specify a userName and password.

// Import of Sun's JMS interface
import javax.jms.*;

// Imports for JNDI
import javax.naming.*;
import javax.naming.directory.*;

// Create the Context
InitialContext jndiContext = new InitialContext();
// Lookup the objects
ConnectionFactory cf = (ConnectionFactory)jndiContext.lookup("uJMSConnectionFactory");
Destination d = (Destination)jndiContext.lookup("TOPIC1");
           

Copyright (c) 2004 - 2014 Informatica Corporation. All rights reserved.