Configuring Generic JMS RA for inbound load balancing
Posted by rampsarathy on January 9, 2007 at 7:03 AM EST
In the last blog we saw how MantaRay peer to peer advantage can be leveraged by applications (using JMS) in GlassFish. One issue that was presented there was duplication of message processing by GlassFish clustered instances when consuming messages from a topic destination. Ideal production requirements can be met, if one and only one cluster instance in GlassFish was allowed to process the message, and even better if this is achieved without any code changes to the application.
This can be achieved by performing few configuration changes to Generic JMS Resource Adapter and the application deployment descriptor.
The following link https://genericjmsra.dev.java.net/docs/topiccluster/loadbalance.html shows how mutual exclusive message delivery to cluster instances can be achieved using generic jms ra.
Briefly the following activation configuration properties need to be added to the sun-ejb-jar.xml (sun specific deployment descriptor for the MDB).
<activation-config-property>
<activation-config-property-name>InstanceCount</activation-config-property-name>
<activation-config-property-value>3</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>LoadBalancingRequired</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
InstanceCount indicates the number of instances in the cluster and the LoadBalancingRequired flag indicates that generic ra needs to guarantee mutual exclusive message delivery to topic subscribers.
Redeploy the application after making the above change to the deployment descriptor.
The following changes would also be required to the instances in the cluster
JVM properties need to be set for each instance in the cluster :
To add JVM property to an instance , Login to the admin console,
Clusters->cluster1->Instance1->Properties->Instance Properties and add the following property for each instance.
For instance 1
com.sun.genericra.loadbalancing.instance.id=0
For instance 2:
com.sun.genericra.loadbalancing.instance.id=1
For instance 3:
com.sun.genericra.loadbalancing.instance.id=2
Restart the cluster (or node agent) after making the above change
Execute the Client programs (samples) now and you would notice that the messages will be processed by only one of the 3 instances in the cluster.
For mode advanced selector configurations , please refer https://genericjmsra.dev.java.net/docs/topiccluster/loadbalance.html.
Related Topics >>
Blog Links >>
- Login or register to post comments
- Printer-friendly version
- rampsarathy's blog
- 695 reads





