Hi Adrian,
Thanks for you information. It is understood that: Transaction propagation
context will not be transfered through messages like Session Bean and Stateless
Bean do;
But we have a scneario that to make two asynchorously responded services in one
transaction. That's the reason we do the above mentioned test.
My impression is that in theory, as long as we have a means to propagte the
transaction context and associate transaction context with the service thread,
it should be working no matter whether we are using synchronus call or
asynchorous call. Does it make sense to you?
Following that logic, I was trying to implement the following logic, but it
still didn't work:
1) On client side,
UserTransaction trans = (UserTransaction)
initialContext.lookup("UserTransaction")
.narrow(o, UserTransaction.class);
trans.begin();
// By converting to JBoss clientUserTransaction,
// I could get TPC (TransactionPropagationContext)
ClientUserTransaction jbossTransImpl =
(ClientUserTransaction)trans;
Object tpc = jbossTransImpl.getTransactionPropagationContext();
// Send this tpc via JMS message to a MessageDrivenBean
...
trans.rollback();
2) On MessageDrivenBean side in onMessage method
// Unpack message and get tpc object
// Use TPC Importer to import tpc into a transaction
TransactionPropagationContextImporter
tpcImporter = (TransactionPropagationContextImporter)
initialContext.lookup("java:/TransactionPropagationContextImporter");
Transaction trans = tpcImporter.importTransactionPropagationContext(tpc);
// Use JBoss Transaction Manager to associate the transaction to the
current Thread
TransactionManager
tpcImporter = (TransactionManager)
initialContext.lookup("java:/TransactionManager");
TxManager jbossTx = (TxManager)tx;
jbossTx.associateThread(trans);
// Call another EntityBean, hopefully the TransactionContext propagtion
could be handled by JBoss container
Do you see it should be working?
Thanks
Peng
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3862599#3862599
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3862599
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user