2 Replies Latest reply on Feb 29, 2012 10:39 AM by miragpl

    Connect standalone Hornteq server without JNDI

    miragpl Newbie

      Hi everyone,


      In my project I have a jboss server to which connect multiple standalone clients. Everyone of such clients have their own standalone hornetq server (we want to sent asynchroonus messages via JMS).


      My problem is that jboss does not know port/ip address of it's clients on deploy time. All those information has to be provided by clients. So basically during login process clients send their Ip address and port of theirs hornetq servers. Having those information Jboss has to create a connection to remote client queue. If clients have JNDI I could use remote JNDI lookup but since they don't I don't know how access their queues.


      Basically it would like it look like that:


      ConnectionFactory cf = getClientConnectionFactory(IP_ADDRESS,PORT)

      Queue destination = getClientQueue(QUEUE_CONSTANT_NAME) <- this a part that I don't know how to do without using remote JNDI lookup


      Connectionconnection = cf.createConnection();

      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

      MessageProducer publisher = session.createProducer(destination);


      I would appreciate any hints