[jboss-user] [JBoss Messaging] - Re: Clustered server preference

chip_schoch do-not-reply at jboss.com
Wed Apr 16 09:54:58 EDT 2008

By the way.

>From the JBoss Messaging Documentation 3.1 
anonymous wrote : A JMS client uses HA JNDI to lookup the connection factory. When creating connections using that connection factory a client side load balancing policy will automatically chose a node to connect to.

>From the Clustering Guide 1.2.2   

anonymous wrote : The JNDI client needs to be aware of the HA-JNDI cluster. You can pass a list of JNDI servers (i.e., the nodes in the HA-JNDI cluster) to the java.naming.provider.url JNDI setting in the jndi.properties file. Each server node is identified by its IP address and the JNDI port number. The server nodes are separated by commas (see Section 1.2.3, JBoss configuration on how to configure the servers and ports).
  | java.naming.provider.url=server1:1100,server2:1100,server3:1100,server4:1100

My use of the JMSProviderLoader in my client

 // Get local InitialContext and look up the ProviderLoader
  | InitialContext ic           = ConnectionManager.getInitialContext ();
  | JNDIProviderAdapter adapter = (JNDIProviderAdapter) ic.lookup ("ConversionJMSProvider");
  | // Get the properties that we need for our target context and
  | // then create the target InitialContext
  | ic= new InitialContext (adapter.getProperties ());
  | // Use the queue factory ref name from the JMSProviderLoader for the lookup     
  | ConnectionFactory factory = (ConnectionFactory) ic.lookup (adapter.getQueueFactoryRef ());

Doing it this way essentially dereferences which connection factory I use based on the environment my service is running in.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144497#4144497

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144497

More information about the jboss-user mailing list