JBoss.org Community Documentation

18.1.3. Load Balanced HA-JMS MDBs

While the HA-JMS queues and topics only run on a single node at a time, MDBs on multiple nodes can receive and process messages from the HA-JMS master node. The contested queues and topics result in load balancing behavior for MDBs. To enable loading balancing for MDBs, you can specify a receiver for the queue. The receiver records which node is waiting for a message and in which order the messages should be processed. JBoss provides three receiver implementations.

  • The org.jboss.mq.server.ReceiversImpl is the default implementation using a HashSet.

  • The org.jboss.mq.server.ReceiversImplArrayList is the implementation using an ArrayList.

  • The org.jboss.mq.server.ReceiversImplLinkedList is the implementation using a LinkedList.

You can specify the receiver implementation class name as an attribute in the MBean that defines the permanent JMS Queue or DestinationManager on each node. For best load balancing performance, we suggest you to use the ReceiversImplArrayList or ReceiversImplLinkedList implementations due to an undesirable implementation detail of HashSet in the JVM.