[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: XARecovery - MQ/Messaging merge
mskonda
do-not-reply at jboss.com
Tue Sep 5 10:51:15 EDT 2006
"timfox" wrote : Hi Madhu-
|
| A few comments:
|
| 1. We need to make sure that any tests for the recovery functionality live in the functional test suite and don't rely on ejbs, mdbs or any other non jms stuff.
|
| The tests should manipulate the XAConnnection/XASession/XAResource, enlist them in global transactions and test them this way.
|
| You may need to add something to simulate a server "crash".
|
I take your point. I do have stanadaone tests but as you said, I'll make sure they don't depend upon non-jms stuff.
anonymous wrote :
| 2. It's my undertstanding that the transaction manager can call XAResource.recover() at any time, not just after server startup.
|
The JBossTS RecoveryManager calls an implementation of XAResourceRecovery which looks for the appropriate xaresource to carry on the recovery. The recovery is not called until XAResource is found. look at the following code:
/**
| * This method checks whether there's an xa resource available
| *
| * @return
| */
| public boolean hasMoreResources() {
|
| if (working)
| return false;
|
| if (xaRes == null) {
| xaRes = initXAResource();
| }
|
| // test the resource
| try {
|
| xaRes.getTransactionTimeout();
|
| working = true;
|
| } catch (Exception ignored) {
|
| // ignore this exception
| log.warn("Exception:" + ignored.getMessage());
| }
|
| return working;
| }
|
So when it calls recover() we need to do the following sequence of actions:
anonymous wrote :
| a) Look in the database for any transactions in the prepared state. If there are any, create transaction objects corresponding to these rows, and add them to the in memory transaction repository in the prepared state (The prepared transactions may already be in the in-memory transaction repository so be careful to avoid duplicates)
|
| b) Return this list to the transaction manager
|
| c) Transaction manager will then call commit on those transactions.
|
Yes, this is the process I've employed. When a transaction is committed, in this case, the message is recvoered and published for the first time. So the subscriber should be able to get it.
However, although, the tx is committed and the message is updated with relevant state, it comes to the same point as I mentioned, the message isn't received by the subscriber!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969485#3969485
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969485
More information about the jboss-dev-forums
mailing list