I have a service class that uses a dao to fetch data from a database, then creates a text file of invoices from the data and uploads that via ftp to an IBM mainframe, then goes back to the database via a dao and marks the entries as billed.
I could treat the ftp upload as a dao as well, and have all 3 operations wrapped in a transaction, so that if any fail all 3 are rolled back.
For the ftp the roll back would be to reconnect and delete the uploaded file, and this is what I don't understand how to hook up. I'm guessing that there's some interface I need to implement or class to extend in order for my ftp class to be transaction aware so that it can do its roll back.
Does anyone have any pointers on how to add low level rollback capability?