Please take a look at:
You'd need to remove the Spring JMS Template from the equation for us to see what's wrong.
This is not working because of th eway the spring jms template works.. firstly i would recommend reading the following http://community.jboss.org/wiki/CanIusetheSpringJMSTemplatewithHornetQ.
So in the failover excample the following occurs.
1. client connects to node1
2. node 1 dies
3. client fails over to node 2.
pretty simple. with Spring jms template the following happens
1. client connects to node 1 and sends a message
2. client disconnects.
3. node 1 dies.
4. client tries to reconnect to node 1 ----> this will always fail since the server is not there any more.
regarding part 2 of your question, this is done by configuring the jca adapter and is explained fully in the user manual.
Thanks for your quick response.
Tim, I'll try removing spring template and check.
For mdb, I've gone through the user manual jca sections and thats how I configured my ra.xml. Everything works fine before crash and only on failover to nodeB the MDB fails to connnect to nodeB.
After seeing this post http://community.jboss.org/message/73364#73364 I tried giving DiscoveryAddress and DiscvoveryPort in the config property of ra.xml but I still could not get the MDB to connect to nodeB on failover.
I've attached ra.xml and jms-ds.xml. Pls let me know if there is anything wrong.
ra.zip 2.7 KB
you can see from looking at the ra config that it is only connectiong to nodeA , i.e. <config-property-value>host=nodeA;port=5445</config-property-value>.
take a look at the user manual section http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/user-manual/en/html_single/index.html#d0e7138 on how to configure it correctly.
Andy, Thank you so much for pointint it out. MDB failover works fine now.
I just have one more question regarding spring jms listener. Should i not use spring jms listener too similar to spring jms templates because i have the same issue with spring listeners on failover.
Using spring listeners because it supports dynamic selectors which we definitely need, thats why i'm curious to know if there is any work around to make spring listeners work on failover with Hornetq.
the spring jms listener is also an anti pattern as discussed in the article so i would suggest not using it.
As for spring dynamic selectors, i am not sure what they are. if you explain on more detail what you are trying to do i may be able to help.
The best thing is not to use any of the Spring wrappers around the JMS API.
What's wrong with the JMS API?
Hi, I dont have any issue with JMS api, it is for the asynchronous receive behavior I used spring listener (which also supports dynamic selector(to consume certain messages based on some condition) which MDB doesn't (only supprts static selector).
Also there is an issue when I configure queue nodeB as another live node instead of a backup of nodeA, i.e now there are two queue nodes in cluster nodeA and nodeB.
MDB is deployed in nodeC and not part of cluster which gets connected to nodeA by auto-discovery and picks all messages from nodeA.
When nodeA is killed (i'm not using ctrl-c on the command line), MDB is unable to discover nodeB.
Will auto discovery not work in case if a node failure as i've configured ra.xml to use the Discovery address and port?
ra.zip 2.5 KB
Hi, I too have the same issue with MDB in Jboss 5.0/ 5.1 GA and Hornetq GA.
When I start a backup node and a live queue node and if the live node crashes then the MDB starts listening to back up node automatically which is good.
But if I just start two live nodes (in cluster) and if one of them crashes (where the MDB is currently listening to) then the MDB does not auto discover the other active node. Pls help.
Like it describes in the user manual (HA chapter), connections fail-over from live nodes to *backup* nodes, not from live nodes to other live nodes.
If you want to failover from live-->live nodes you can add a feature request in JIRA if you like.
The MDB failover from live -->live nodes seems to be working, only the reply messages from mdbs are not sent after failure.
Started two nodes node1 and node2 both as live nodes but (by mistake) I configured node2 as a backup node for node1 in ra.xml. Started MDB in node3 which was configured to consume messages from node1.
Everything worked fine and messages were distributed to node1 and node2 in round robin style. When node1 is killed, mdb automatically failed over from node1 to node2 and started consuming messages from node2 though it is not a bakcup server.
Is this the expected behavior?
I'm not sure what you meant by:
"The MDB failover from live -->live nodes seems to be working, only the reply messages from mdbs are not sent after failure."
Is it working fine or not?
Hi, I understand from the above posts that MDB cannot failover from one live node to another live node automatically, but is it possible through code to handle this so that the MDB can failover from one queue live node to another?
Say in my case I have a cluster of two queue nodes A and B. I've my MDB in node c and by default it picks messages from node A only.
When nodeA goes down, my MDB goes idle and yes i do understand that Hornetq2.0.0. GA does not support MDB auto failover from one live to another live node, but is there a way that i can handle it in my code so that after 5 attempts it should connect to nodeC and pick messages from there?
Pls help. Thanks!