Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Using ActiveMQ via JNDI

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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");