Advertisement
Guest User

Using ActiveMQ via JNDI

a guest
Feb 26th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Properties jndiParameters = new Properties() ;
  2. jndiParameters.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
  3. jndiParameters.put(Context.PROVIDER_URL, "tcp://localhost:61616");
  4. Context context = new InitialContext(jndiParameters);
  5. ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("ConnectionFactory");
  6. Queue queue = (Queue) context.lookup("MyQueue");
  7.  
  8. Context context = new InitialContext();
  9. ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("ConnectionFactory");
  10. Queue queue = (Queue) context.lookup("MyQueue");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement