0
votes

I am new to activeMQ, I have issues pushing messages to a queue defined by activeMQ from a message producer residing on another server.

I have a few queues in the application created on activeMQ using camel routes. I am trying to perform remote JNDI lookup on these queues from an application on another server. I have used the snippets from activemq documentation from http://activemq.apache.org/jndi-support.html page.

I could get connected to the activeMQ, but I couldn't look up the queues defined using camel routes.

The queue consumer is created through the camel route defined below. from("jms:queue:APP.IF.JMS.OUTBOUND") .... // This route does some processing.

But I don't see this queue in the lookup as performed below -

    String destination = "APP.IF.JMS.OUTBOUND";
    ConnectionFactory cf = null;
    Destination dest = null;
    Context ctx = null;
    Properties params = new Properties();
    readProperty(params, Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory", false);
    readProperty(params, Context.PROVIDER_URL, "tcp://localhost:61616", false);
    readProperty(params, "queue.AS.IF.JMS.REQUEST",
     "AS.IF.JMS.REQUEST", false);

    ctx = new InitialContext(params);
    cf = (ConnectionFactory) ctx.lookup("ConnectionFactory");
    System.out.println(ctx.getEnvironment());
    dest = (Destination) ctx.lookup(destination);
    ..............

The last line fails when lookup is done on this queue. I do see this on the console. Am I missing some configuration to expose this queue on JNDI? Appreciate your response.

1

1 Answers

0
votes

Change the word localhost in your PROVIDER_URL to your machineName. Since it is remote operation, it needs your machine name.