My enterprise application makes use of a MySQL instance. This instance, which I will call "primary", is also replicated to a second MySQL instance, which I will call "slave".
Both "primary" and "slave" are registered JNDI DataSources within JBOSS.
Setting up JMS, I declare a PersistenceManager and StateManager to use the "primary" MySQL instance.
The above setup runs great. My application delivers asynchronous messages into the JMS Queue configured in JBOSS. JBOSS creates and uses it's JMS tables in the "primary" MySQL instance. Everything is perfect.
PROBLEM. My application has failover logic such that if it detects problems connecting to the primary database, it will start using the slave database. Its s imple exercise in looking up the JNDI DataSource definition associated with the slave database and getting a new ConnectionPool. the application starts using the slave database, and there are no problems.
BUT the JBOSS PersistenceManager and StateManager are still trying to use the primary database, and are getting connection failure. Essentially, all asynchronous messages are lost.
Is there a configuration in JBOSS JMS that allows for the Persistence and State managers to failover to a different JNDI DataSource is the primary fails? I've started reading HAJMS, but nothing I have seen so far leads me to believe that it can do this.
Can someone give me advice on this problem? Point me to a URL that discusses a solution?