We are thinking about switching from JBossMQ to JBossMessaging. I have read user guide for JBM 1.4.0 SP3 and few messages on forum but I think I still need clarification about how messages are distributed across nodes in cluster configuration. I read a following topic but still don't know if I understand everything correctly.
We have three application servers, called AS1, AS2, and AS3. Our application is assembled from:
Producer A (singleton) - deployed only on AS1
Queue A (clustered)
Consumer A - deployed on all nodes
Producer B - deployed on all nodes
Queue B (clustered)
Consumer B - deployed on all nodes
Deployment and messages flow:
(AS1) Producer A ---> Queue A ---> Consumer A/Producer B ---> Queue B ---> Consumer B (AS2) Queue A ---> Consumer A/Producer B ---> Queue B ---> Consumer B (AS3) Queue A ---> Consumer A/Producer B ---> Queue B ---> Consumer B
As you can guess, I wish that load related with queue A will be balanced across cluster. If I understand correctly, if non-loadBalanced ConnectionFactory will be used in Producer A only Consumer A on AS1 will be used to handle whole load, right? (according to the rule: 'local consumer is preferred')
Have it got any matter how many elements will be in queueA? Is there any starvation-protecting mechanism which will sends part of messages across cluster if 'number of messages' or 'time in queue' exceed some limit?
In other words, is there any situation where rule: 'local consumer is preferred' will be ignored.
If I understand correctly the best I can do is to use loadBalanced ConnectionFactory in Producer A. Then different connections created via this ConnectionFactory will be attached to various nodes. Then load will be balanced. Am I right?
Second issue is about rule: 'local consumer is preffered'. If I understand correctly in cluster configuration every node has its own 'local queue' for every queue.
In fact it may be very useful feature for us, if part of the flow stay on one node. It means behavior where: Consumer A on AS2 gets a message, process it and send new message to queue B (via Producer B on the same node: AS2), then Consumer B on the same node (AS2) will be used to process this message. So part of the flow: 'Consumer A/Producer B ---> Consumer B' will be processed on the same node.
If I understand correctly this will happen if non-loadBalanced ConnectionFactory will be used in Consumer A, Producer B and Consumer B, right?
Will it be ok, if Producer A sends message via loadBalanced ConnectionFactory to QueueA and Consumer A use non-loadBalanced ConnectionFactory to consume such message?
Most important question in this approach is about failover. Lets say that there is processing and all queues (especially QueueB) keeps messages (each node has its own messages in its own 'local queue') and then, lets say, AS2 go down. Will messages related with AS2 be seamless distributed to other nodes?