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/10 11:20:06 UTC

[GitHub] jimforcode commented on issue #327: io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.

jimforcode commented on issue #327: io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.
URL: https://github.com/apache/servicecomb-pack/issues/327#issuecomment-453061423
 
 
   i've  meet the same problem,
   my code is:
   
   `  @Compensable(compensationMethod = "cancel")
       public Integer  get(T1 t1){
           int res= t1Dao.insert(t1.getId(),t1.getName(),t1.getAge());
            return res;
       }
       public Integer cancel(T1 t1){
           System.out.println("--- 事务补偿机制开启 ---");
           System.out.println(t1);
           System.out.println("开始删除数据: "+t1Dao.delete(t1.getId()));
           System.out.println("---事务补偿机制结束---");
           return 1;
       }`
   
   ` @Transactional
       @SagaStart
       @Compensable(compensationMethod = "cancel")
       public Object get(T2 t2){
           int res=   t2Dao.insert(t2.getId(),t2.getName(),t2.getAge());
           Map<String, Object> uriVariables=new HashMap<>();
           uriVariables.put("id",t2.getId());
           uriVariables.put("name",t2.getName());
           uriVariables.put("age",t2.getAge());
           ResponseEntity<String> resStr=null;
           ResponseEntity<String> resStr2=null;
           resStr=  template.getForEntity(String.format("http://localhost:12000/t1?id=%s&name=%s&age=%d",t2.getId(),t2.getName(),t2.getAge()),String.class);
           System.out.println("server001:"+resStr.getBody());
   
           resStr2=  template.getForEntity(String.format("http://localhost:12002/t3?id=%s&name=%s&age=%d",t2.getId(),t2.getName(),t2.getAge()),String.class);
   
           System.out.println("server003:"+resStr2.getBody());
   
           return String.format("server001:%s ,server002:%s ,server003:%s",resStr.getBody(),res+"",resStr2.getBody());
       }
   
       public Object cancel(T2 t2){
           System.out.println("开始事务补偿机制 start  。。。。");
           System.out.println("开始事务补偿机制 end 。。。。");
            return "起点重合";
       }`
   
   error msg :
   
   ![image](https://user-images.githubusercontent.com/13187186/50965225-5ae10d00-150c-11e9-92d8-7d86d34d7285.png)
   
   ![image](https://user-images.githubusercontent.com/13187186/50965252-6f250a00-150c-11e9-906d-fe06a37b2bf2.png)
   
   ![image](https://user-images.githubusercontent.com/13187186/50965366-ba3f1d00-150c-11e9-87b6-bc438462ce29.png)
   
   
   
   
   
   
   
   
   
   
   
   
   

----------------------------------------------------------------
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