Creating JMS client producer sending to cluster.
raymanf Feb 25, 2013 2:27 AMHi,
I am using HornetQ 2.1.1 integrated inside Spring3.1 (stand alone env)
I have managed finally to configure my cluster mode(HA). I can confirm this when the backup server comes up it writes:
Feb 25, 2013 9:20:07 AM org.hornetq.core.logging.impl.JULLogDelegate info INFO: backup announced
I have created a client in order to test my env. my target is:
Sending a message after taking down the master cluster node. And have the backup node to deal with the request without the client being noticed.
When I used to work in jboss I could set a Partition Name/Discoverygroup so we dont need to set an exact target ip of a node in the client producder (for such cases).
But now that I work in standalone env I have no idea how to do it.
How should I modified my client and my cluster env code in order to send to Partition name/DiscoveryGroup and not an exact ip a jms message?
so when 1 node being off the second one will take the request automaticlly (after all that is what my cluster about:) )
My client produder code:
Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces"); p.put(Context.PROVIDER_URL, "localhost:1099"); InitialContext context = new InitialContext(p); TopicConnectionFactory myConnFactory; Topic myTopic; System.out.println("connection factory lookup"); myConnFactory = (javax.jms.TopicConnectionFactory) context.lookup("java:/ConnectionFactory"); System.out.println("topic lookup"); myTopic = (Topic) context.lookup("/topic/liquiditiyFeedTopic"); topicConnection = myConnFactory.createTopicConnection(); topicSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); topicConnection.start();
thanks,
ray.