I have service with 3.party external service integration.
My Service do something in my Database.
if exception occurs on my service then I do not call 3.party service it is ok.
But if 3.party service create exception. I was already completed operations on my database!
For solve this problem I changed design of service DB using, All DB operations start with a Transaction and I check 3.party service response also ok. And then I commit that transaction or Rollback for revert my local changes. It seams easy But.
With transactional operation I lock resources until finish 3.party service response. I this design takes long time and dramatically effect service performance. One call waits another call until transaction finish or rollback.
Do you have best practice knowledge this kind of situate?
My decision Use Database operations without transaction and if 3.party call creates exception Call another Database operation for Revert back to old values to the Database. It is little bit difficult but I think there is only one way. Or I missing some part. Thank you.
- Service point
- Create Transaction
- Local Database Operations
- Call 3.party integration service (wait) Lost time here and transaction lock still exists
- Commit or Rollback Transaction
Aucun commentaire:
Enregistrer un commentaire