-
1. Re: Message redistibution between 2 MDB's
clebert.suconic Apr 9, 2008 11:01 AM (in response to sameuh)The ClusterRoundRobingDistributor aways favour the local queue on the Cluster.
public Delivery handle(DeliveryObserver observer, MessageReference ref, Transaction tx) { //First try the local distributor if (trace) { log.trace(this + " first trying with local distributor"); } Delivery del = localDistributor.handle(observer, ref, tx); if (trace) { log.trace(this + " local distributor returned " + del); }
So.. if you have your MDB on ServerA and Producer on ServerA, the MDB on ServerA will aways receive the messages.
If you were sending to a ServerC with no consumers on it, then the load would be balanced between ServerA and B.
If you need that kind of load, you could be using two producers, on two distinct connections created by a ClusteredConnectionFactory. -
2. Re: Message redistibution between 2 MDB's
timfox Apr 10, 2008 4:05 AM (in response to sameuh)To elaborate on what Clebert has already said - also I think this has been covered before on other threads.
JBoss Messaging has "connection load balancing" - this means that if you use a connection factory with the attribute "supportsLoadBalancing" set to true, then subsequent create connection attempts will be made on different nodes of the cluster in a round robin fashion, the first node is chosen randomly.
This gives an even distribution of connections across the cluster.
If you have a clustered queue deployed on all nodes of the cluster, and a MDB consuming on all nodes from that queue, and you send a message via one of the connections you created to one of the nodes, then, if the local MDB exists and is not busy , JBM will always *favour* the local MDB. There is no point in the message being processed on another node if it can be happily processed on the local node (it's a waste of network hops).
Here's the bit Clebert did not mention: If the local MDB does not exist or is busy, and another MDB on another node for the same queue is idle then the remote MDB can pull messages from other nodes - this is called "message redistribution".