Load-balanced, fault-tolerant MDBs in HAJMS
NOTE: This example is a contribution from a user.
You should use hajndi-jms-ds.xml not the jms provider in this example. TODO: update this example
Load-balancing message processing with MDBs is one of the best ways
to distribute load across a cluster because the node with the least
activity will process the message (as opposed to a round-robin
load-balancing algorithm which could continue to place load on an
already overloaded node). The 3.2.4RC2 (April 13, 2004 drop) does
not have load-balancing capabilities for MDBs across a cluster.
Meaning, you cannot distribute the processing load across MDBs
that are deployed on nodes other than the HASingleton node. For
instance, if you deploy an MDB on a non-master node in HAJMS, it will
fail because the proper JMS services are not configured locally (they
only exist on the master node!).
The attached example, load-balanced-mdbs-example.zip, describes
how to setup JBoss HAJMS for load-balancing your message
processing across a cluster using MDBs. It uses a custom JMS
Provider that allows MDBs to connect to the JMS HASingleton node and
process messages from it whether they are deployed on the master node
or not. When the singleton HAJMS server fails and another is
selected, the custom JMS Provider re-connects (DLQHandlers,
JMSContainerInvoker, etc.) to the new master node's resources whether
the new master node is the local server or another remote server.
The MDBs on live nodes keep on processing messages!
Comments