-
1. Re: How to make ftp resources transaction aware
mmusgrov Dec 15, 2008 4:31 AM (in response to mohitanchlia)What is your "ftp client object". Does it implement javax.transaction.Synchronization - if so you simply register it with the Transaction. You can get the current transaction from the javax.transaction.TransactionManager (ie com.arjuna.ats.jta.TransactionManager.transactionManager() if you are using JBossTS).
-
2. Re: How to make ftp resources transaction aware
mmusgrov Dec 15, 2008 4:45 AM (in response to mohitanchlia)I am planning to store all the files names in memory that needs to get removed from ftp server, and only when afterCompletion is called this client will issue remoe for those files on ftp server.
I've just re-read your post - the afterCompletion() call is not guaranteed to be called. You need to enlist a resource in the transaction - simply provide an implementation of XAResource (that does the same stuff you were planning to put into afterCompletion()). -
3. Re: How to make ftp resources transaction aware
marklittle Dec 15, 2008 10:05 AM (in response to mohitanchlia)And don't forget to make it recoverable (and XA compliant) too :-)
-
4. Re: How to make ftp resources transaction aware
mohitanchlia Dec 15, 2008 11:22 AM (in response to mohitanchlia)I think I am kind of confused, may be because I have not written XAResources before. We are using Jboss 4.2 and UserTransaction in BMT. Could you please point me to place where I can get information about what you are trying to help me with.
-
5. Re: How to make ftp resources transaction aware
mmusgrov Dec 15, 2008 12:14 PM (in response to mohitanchlia)Creating XA resources is defined in JSR 907: JavaTM Transaction API (JTA).
Basically you just need to implement javax.transaction.xa.XAResource and enlist it with the current transaction. -
6. Re: How to make ftp resources transaction aware
mohitanchlia Dec 15, 2008 8:58 PM (in response to mohitanchlia)Is there an example I can look at. I just want a basic implementation. Looking at Jboss JTA manual "The XAResouce Interface", seems more complicated then I want it to be.
-
7. Re: How to make ftp resources transaction aware
marklittle Dec 16, 2008 7:13 AM (in response to mohitanchlia)Take a look at the JBossTS source and examples. There are examples.