vwjugow

code1

Feb 1st, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. CamelContext context = new DefaultCamelContext();
  2. ConnectionFactory connectionFactory = null;
  3. // connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:5445");
  4. // HornetQConnectionFactory c = new HornetQConnectionFactory();
  5. connectionFactory = HornetQJMSClient.createConnectionFactory("127.0.0.1", 5455);
  6. Thread.sleep(1000);
  7. Connection connection = connectionFactory.createConnection();
  8. Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
  9. final Properties env = new Properties();
  10. env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
  11. env.put(Context.PROVIDER_URL, "remote://localhost:4447");
  12. InitialContext context1 = new InitialContext(env);
  13. System.out.println("4");
  14. ConnectionFactory cf = (ConnectionFactory) context1.lookup("jms/RemoteConnectionFactory");
  15. System.out.println("5");
  16. Queue queue = (Queue) context1.lookup("jms/queue/someQueue");
  17. System.out.println("6");
  18. connection = cf.createConnection("vwjugow", "pass");
  19. System.out.println("7");
  20. session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
  21. System.out.println("8");
Advertisement
Add Comment
Please, Sign In to add comment