You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/01/28 07:57:58 UTC

[GitHub] rareman opened a new issue #400: 我的Saga事务不能保证完整性

rareman opened a new issue #400: 我的Saga事务不能保证完整性
URL: https://github.com/apache/servicecomb-pack/issues/400
 
 
   根据tag:0.3.0用户指南写了个demo
   
   ```
     @SagaStart(timeout=10)
     public boolean transferMoney(String from, String to, int amount) {
       self.transferOut(from, amount);
       self.transferIn(to, amount);
     }
   
     @Compensable(timeout=5, compensationMethod="cancel")
     @Transactional
     public boolean transferOut(String from, int amount) {
       return true;
     }
   
     @Transactional
     public boolean cancel(String from, int amount) {
       return true;
     }
   
     @Compensable(timeout=5, compensationMethod="cancelTransferIn")
     @Transactional
     public void transferIn(String to, int amount) {
       try {
         TimeUnit.SECONDS.sleep(15L);
       } catch (InterruptedException e) {
         throw new RuntimeException(e);
       }
       throw new IllegalArgumentException("transter fail");
     }
   
     public void cancelTransferIn(String to, int amount) {
       throw new IllegalArgumentException("transter cancel fail");
     }
   ```
   
   - 问题1
   
       transferIn抛出异常后本地事务回滚,cancelTransferIn会再撤销
   
   - 问题2
   
       cancel不会执行

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services