Hi,
i am using web services to synchronise data from my database with several other databases/companies (all NAV).
E.g. when i change data in my database webservice calls to the other systems are made to replicate the change in their database.
If there is an error raised in one of the systems, I should rollback the changes in all databases. I want all the systems to stay synchronised.
Is there a possibility to handle this scenario?
0
Answers
Short answer is NO.
This is only possible if it was designed to do so. Always make sure that the receiving side has successfully executed the webservice function. Only then the consuming side should continue.
So you should track any changes per webservice call made, if synchronisation was successful.
If not, maybe retry a few times (in case of a locking problem or timeout), if that doesn't succeed, do what you got to do, and that is undo the changes in the databases that were succesfully synched.
A Rollback will not be possible, because each database has its own logic of committing transactions.
This doesn't seem like a stable solution to me.
I had the idea to keep all the transactions in all systems open until the last system tells me everything is fine and then fire the commit in all systems to close the transaction. But this seems to be very tricky since every webservice call means a new session in NAV and also I might get locking-problems if a lot of systems are involved.
I think I will just go with an error log. So I allow the systems to get out of sync but give the user the neccessary information to repair the data where needed.