1 18 package org.apache.activemq.tool; 19 20 import javax.jms.Connection ; 21 import javax.jms.ConnectionFactory ; 22 import javax.jms.Queue ; 23 import javax.naming.InitialContext ; 24 25 28 public class JndiProducerTool extends ProducerTool { 29 30 public static void main(String [] args) { 31 runTool(args, new JndiProducerTool()); 32 } 33 34 protected Connection createConnection() throws Exception { 35 InitialContext jndiContext = new InitialContext (); 36 37 ConnectionFactory queueConnectionFactory = (ConnectionFactory ) jndiContext.lookup("ConnectionFactory"); 38 Connection connection = queueConnectionFactory.createConnection(); 39 destination = (Queue ) jndiContext.lookup(subject); 40 return connection; 41 42 } 43 44 } 45 | Popular Tags |