users@glassfish.java.net

glassfish v3 jms

From: <glassfish_at_javadesktop.org>
Date: Thu, 07 Oct 2010 13:04:26 PDT

What do i have to change in this code, if my Quote is on another Host(ip: 10.73.0.9)?

My english is not good, but i don't find the solution in web.

Thanks.
Cassio.



try {
            jndiContext = new InitialContext();
            System.out.println("CONEXAO");
            connectionFactory = (ConnectionFactory)jndiContext.lookup("jms/CF");
            queue = (Queue)jndiContext.lookup("jms/Queue");
            connection = connectionFactory.createConnection();
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            messageProducer = session.createProducer(queue);
            // object that will send
            Quotes quote = new Quotes("^BVSP", new Date(), counter++, 0, 0, 0, (int)(Math.random() * 100));
            msg = session.createObjectMessage(quote);
            msg.setStringProperty("symbol", quote.symbol);
            msg.setFloatProperty("volume", quote.volume);
                        // send object
            messageProducer.send(msg);
            connection.close();
} catch (NamingException e) {
            Logger.getLogger(JMSEnvio.class.getName()).log(Level.SEVERE, null, e);
}
        catch (JMSException e) {
            Logger.getLogger(JMSEnvio.class.getName()).log(Level.SEVERE, null, e);
} finally {
            System.out.println("ENDED.");
            //System.out.println("PROVIDER_URL: " + properties.get(Context.PROVIDER_URL));
            if (connection != null) connection.close();
}
[Message sent by forum member 'cassionoronha']

http://forums.java.net/jive/thread.jspa?messageID=484573