(このサンプルではトランザクションを利用しないのでfalse) // Step 1. Create an initial context to perform the JNDI lookup. final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.put(Context.PROVIDER_URL, "jnp://localhost:1099"); // 認証かかってる場合は、ここでユーザ・パスワードを指定する initialContext = new InitialContext(env); // Step 2. Perfom a lookup on the queue Queue queue = (Queue)initialContext.lookup("/queue/ExampleQueue"); // Step 3. Perform a lookup on the Connection Factory ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); // Step 5. Create a JMS Session Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); ベンダ依存しないので、クライアントを 変えることなく、MOM製品を変更する ことが可能。(理論上は)