If anybody implemented transactional writing to file,please, assist me.
Related topic was discussed in earlier thread(transactional write).
Use case is following:
if writing to log file is failed,that appropriate DB transaction shoud be rolled back.
So the writinig to file should be performed in transactional way.
I've chosen Apache Commons Transaction lib.
And have issue,that doesn't let me go further,because haven't found appropriate documentation or examples.
I have created instance of FileResourceManager:
FileResourceManager frm = new FileResourceManager("c:\cur", "c:\cur", true, logger);
As I understand from this Apache Commons Transaction tutorial,i should implement following steps:
start transaction:
frm.start();
get transaction Id for it:
transactionId = frm.generatedUniqueTxId();
call method, that is needed, e.g. writeResource with transactionId and resourceId:
frm.writeResource(transactionId, resourceId);
And here is ambiguity:
a) how can I connect resourceId
with real resource,that I should write transactioanally?
b) how do my file,that I will write transactionally will now about resourceId
?
Thank you for advise.