I am trying to configure the HornetQ cluster using static connectors.
following are configuration for Cluster Node:
<netty-connector name="netty-connector-cluster-node" socket-binding="jms-cluster-node"/>
To connect standalone JMS Clients, i am using following piece of code.
Here in PROVIDER_URL i am providing the comma seperated values of JMS nodes.
public class JMSConnection
private static String topicConnectionFactoryName = "testConnectionFactory";
private static TopicConnectionFactory topicConnectionFactory;
private String initialContextFactoryName = "org.jboss.naming.remote.client.InitialContextFactory";
private String providerURL = "http-remoting://node1:9001,http-remoting://node2:9001";
private static InitialContext initialContext;
public JMSConnection() throws NamingException
Properties h = setContextProperty(initialContextFactoryName, providerURL);
initialContext = new InitialContext(h);
* @param args
* @throws NamingException
public static void main(String args) throws NamingException
public static Properties setContextProperty(String contextFactory, String providerUrl)
Properties prop = new Properties();
// For Jboss 7 on App Server these properties are passed as blank so we don't need to set
prop.put("jnp.disableDiscovery", System.getProperty("jboss.global.jnp.disableDiscovery", "true"));
1. Node-1 - Active and Node-2 Backup
In this case, JNDI lookup works fine and i get the reference of connection factory.
2. Node-1 Backup and Node-2 Active
In this case, JNDI lookup is throwing NamingException that connection factory is not found.
What i understand here that Since Connection factory is registered into Node-2, while Provider-url is having 1st entry for Node-1 (which is running in backup mode and doesn't have connection factory registered).
Since Node-1 is up and running so JNDI lookup manages to make connection with node-1 and doesn't find connection factory registered, so throws an exception.
Can someone please suggest the better way to write the Clients for this scenario, or there is something, which can be done in Wildfly configurations for hornetQ server.?
even MDB clients are failing to find out the active node.
Note: I didn't see this kind of issue with Multicast based clustering configurations, but i can't use multicast based clustering, since it will not be supported with Amazon Cloud.
Thanks in advance.