简体   繁体   中英

Distributed transaction using web services on different platforms

is it possible to achieve transactionality using web services that are implemented in different technologies?

For example: let's imagine a case where we want to offer an integrated service of 2 different organizations, each of which already have their different systems implemented using different technologies and located in different countries. Organization A has a Java server exposing Rest services that allow consumers to insert data in a table, then Organization B has a.Net server exposing Rest services that also allow consumers to insert data in a table. Then I want to create a new server to integrate both these services in one, allowing consumers to insert in both organization's databases. So from this new server I have to invoke those 2 rest services in a transactional way (meaning that both organizations will insert or none will insert if there is a failure, it will rollback).

Is that possible to achieve even tho server 1 and server 2 are implemented with different technologies? What if there were n servers all implemented in different technologies and all exposing Rest services?

It is not possible to have real transactions in case of microservice architecture. You have to implement compensations which roll back changes in case of failures. See Saga pattern for one of the approaches.

Look at the Cadence Workflow that makes implementing Sagas trivial. Here is an example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM