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

Reply via email to