2018-07-02 22:49 GMT+08:00 Willem Jiang <willem.ji...@gmail.com>: > Hi Yonglun, > > It's great that Saga can be part of Sharding-Sphere solution. > Current we can update the json data formate to support the parameter of > SQL. > And we just need to implement SQL invocation (transport) in Saga, then you > can just tell Saga executor to do the invocation job for you. > You mean that the executor could run the SQL and access the database directly ?
> > I will try to add some sample code to show the whole idea tomorrow. > Can you put some pseudo codes here and we can discuss please ? > > Willem Jiang > > Twitter: willemjiang > Weibo: 姜宁willem > > On Mon, Jul 2, 2018 at 9:51 PM, 张永伦 <15810310...@163.com> wrote: > > > Hi all, > > > > > > I'm a developer from Sharding-Sphere(https://github.com/sharding-sphere > ). > > I'd like to make a proposal on integrating Sharding-Sphere(SS) with Saga. > > > > > > SS starts a transaction via Saga API(https://github.com/apache/ > > incubator-servicecomb-saga/blob/old-saga/docs/api/api.md). The API looks > > like this: > > { > > "policy": "", > > "requests": [ > > { > > "id": "", > > "type": "", > > "serviceName": "", > > "parents": [ > > > > ], > > "transaction": { > > "method": "", > > "path": "", > > "params": { > > > > } > > }, > > "compensation": { > > "method": "", > > "path": "", > > "params": { > > > > } > > } > > } > > ] > > } > > Logic SQLs in a SS transaction will be treated as one Saga Request > > separately. Users of SS should supply the compensatory SQLs > correspondingly: > > transaction: > > INSERT INTO `t_order` (`order_id`, `user_id`, `status`) VALUES (?, '10', > > 'INIT'); > > compensation: > > DELETE FROM `t_order` WHERE `order_id`=?; > > > > > > SS need to implement method of both transaction and compensation for > Saga. > > The path parameter seems to have no use for SS, and should be ignored. > > > > > > The content of params should include SQL and the parameter of SQL, may > > implement by currently form parameters. > > > > > > At last, id and serviceName will be generated by SS uniquely. Saga can > use > > these identifier to find transactions. > > > > > > > > > > Thanks, > > Zhang Yonglun >