Broker 10.5 | webMethods Broker Documentation | webMethods Broker Messaging Programmer's Guide | JMS Policy Based Client-Side Clustering | Configuring webMethods Client-Side Clustering for JMS | Enabling Load Balancing and Failover in Your JMS Applications
Enabling Load Balancing and Failover in Your JMS Applications
You need not change the code in your JMS applications to enable load balancing feature if JNDI provider is used to store the connection factory data. The webMethods API for JMS will enable or disable load balancing based on the existence of a Broker cluster and load balancing policy definition when a JMS connection is made.
*If the connection factory is defined with only one Broker or without a load balancing policy, all message publishing and receiving will be ordinary JMS messaging.
*If the connection factory is associated with a Broker cluster (multiple Brokers) and a load balancing policy is specified, all the Brokers in cluster will work as a single Broker and distribute the messages according to the load balancing policy.
*If your existing JMS application is using Broker List feature, it is recommended that you update your code to use the load balancing clustering feature. For example, if your current code is similar to:
WmConnectionFactoryImpl cf = new WmConnectionFactoryImpl();
cf.setBrokerName("Broker #1");
cf.setBrokerList("Broker #1@localhost:6849, Broker 2@localhost:6949");
Update your code to use the JMS Policy based clustering feature by replacing setBrokerList() with setClusterPolicy() & setBrokerCluster():
WmConnectionFactoryImpl cf = new WmConnectionFactoryImpl();
cf.setBrokerCluster(new String[] {"Broker #1@localhost:6849",
"B2@localhost:6949", "B3@localhost:7010"});
If you create a cluster using the user interface in My webMethods, the cluster validation process ensures that the specified Brokers are in the same cluster and synchronizes the document types and client groups details in all the Brokers in the cluster.
Note:webMethods Broker client-side clustering for JMS client applications does not validate at the webMethods API for JMS level to check if the specified Brokers are in the same cluster or not. Make sure that all the Brokers used for publishing and subscription are defined in the same cluster. All the Brokers in the cluster must have identical document type and client group information.