A common requirement is to add a bit of transactional behavior in FTP operations:
Example:
- FTP file1 to remote dir /path/to/myfiles
- FTP file2 to remote dir /path/to/myfiles
- tell remote system that he can start processing file1 and file2
If FTP of file2 fails, you don't want to leave file1 hanging around.
So you should add a fastidious compensation action in the Error Handler of "FTP file2" to undo the "FTP file1" operation.
Also, fastidiously the file could be picked up by remote system before I end transferring it (it should not happen, I guess it depends on the FTP server implementation, it's just one extra concern I have).
This clearly sucks.
Luckily the Oracle JCA FTP Adapter supports moving remote files.
The FTPMove operation with Type="MOVE" has been successfully tested, using Transport Headers to pass the "file name from" and "to" parameters to the JCA Adapter.
Interestingly enough, you can also COPY and DELETE files remotely.
So our flow will be:
- FTP file1 to remote dir /path/to/myfilestemp
- FTP file2 to remote dir /path/to/myfilestemp
- FTP move file1 to /path/to/myfiles
- FTP move file2 to /path/to/myfiles
Ok you will say "what if - ##FTP move file2 to /path/to/myfiles## fails?".
Well, I guess that can happen....
Saturday, December 3, 2011
Subscribe to:
Post Comments (Atom)
4 comments:
Hi, I follow your post but I have a trouble when I move big files, the error message is:
Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'readEBS'
failed due to: The IO operation failed. The IO operation failed. The "OPER[NOOP][NONE]" IO operation for "/tmp/TestLogSOA/DetalleCostos3333333.dvd"
failed. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on
resource 'SOADataSource_ohsdomain': XAER_NOTA : The XID is not valid oracle.jdbc.xa.OracleXAException at
oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1532) at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:321) at
weblogic.jdbc.wrapper.VendorXAResource.start(VendorXAResource.java:51) at weblogic.jdbc.jta.DataSource.start(DataSource.java:722) at
weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1228) at
weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1161) at ...
When I'm moving small files everything it's OK except when the files are more than 50 MB.
Thanks!!
"The XID is not valid" is typically a DB transaction Timeout... the transaction has been rolled back on the DB due to a Distributed Timeout, and when you try to commit it from the Transaction coordinator (WebLogic JTA) the transaction is no longer there on the DB.
I would suggest you to
- either avoid using a XA datasource for the access to the DB in this specific interface
- or increasing the default distributed timeout at DB level (talk to a DBA for this)
But if it's an ftp adapter, how I can change de XA datasource?; in other web pages I read about "SOADatasource" but I don't understand if I need change the values of XA and timeout in this datasource because I'm using the FTP Adapter.
somehow you are FTP'ing in a transaction where also SOADataSource_ohsdomain is enrolled as a participant
If you activate the WebLogic debug flag JTA you should have plenty of info about TX in the logs... but even without it, on the Server/Monitoring/JTA console you should see all the resources enrolled in your active transaction while you are FTP'ing...
Post a Comment