1 Reply Latest reply on Feb 6, 2013 12:22 AM by clebert.suconic

    HornetQ remote standalone. Possible?

    junesh1983

      I have been trying with a standalone Hornetq using localhost port 1099 connection for my JMS queues. I needed to create queue dynamically and succeeded in using JMX api. These are my connection strings.

      Creating queue:

       

           private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://10.58.189.161:13333/jmxrmi";

           MBeanServerConnection mbsc = connector.getMBeanServerConnection();

           ObjectName name=new ObjectName("org.hornetq:module=JMS,type=Server");

           JMSServerControl control = (JMSServerControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,name,JMSServerControl.class,false);
           control.createQueue("Test01","queue/Test01");

       

      then i use the queues in such way

       

      private static InitialContext getInitialContext() throws NamingException {

      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

      env.put(Context.PROVIDER_URL, "jnp://10.58.189.161:1099");

      return new InitialContext(env);

      }

       

      initialContext = getInitialContext();

      Queue requestQueue = (Queue)initialContext.lookup("/queue/requestQueue");

      ConnectionFactory cfact = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");

      connection = cfact.createConnection();

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

      replyProducer = session.createProducer(null);

      requestConsumer = session.createConsumer(requestQueue);

      requestConsumer.setMessageListener(this);

      connection.start();

       

      public void onMessage(final Message request)

          {.......}

       

      My jms queues are meant to send acknowledge using temporary queues.

       

      So far its working well with localhost. My question is how can I move the hornetq server to a server (meaning run.bat running on a server or another PC) and i connect remotely to it?

       

      Thanks in advance.