You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/08/16 07:06:08 UTC

[GitHub] [incubator-shardingsphere] huangjian888 opened a new issue #2881: shardingsphere+seata+dubbo No Rollback

huangjian888 opened a new issue #2881: shardingsphere+seata+dubbo No Rollback
URL: https://github.com/apache/incubator-shardingsphere/issues/2881
 
 
   I have consulted relevant documents and issues,but no solution has been found.
   The project uses shardingsphere + Seata + Dubbo,but does not roll back using Dubbo
   
   Dubbo provider Code:
   import com.alibaba.dubbo.config.annotation.Service;
   import com.baomidou.mybatisplus.service.impl.ServiceImpl;
   import com.company.spring.boot.shardingsphere.seata.modules.entity.OrderEntity;
   import com.company.spring.boot.shardingsphere.seata.modules.mapper.OrderMapper;
   import com.company.spring.boot.shardingsphere.seata.modules.service.IOrderService;
   import io.seata.core.context.RootContext;
   import io.seata.spring.annotation.GlobalTransactional;
   
   @Service
   public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> implements IOrderService {
   
       @Override
       public void insertOrder(OrderEntity orderEntity) {
           System.out.println("XID:"+ RootContext.getXID());
           baseMapper.insert(orderEntity);
       }
   }
   Dubbo consumer Code:
   import com.alibaba.dubbo.config.annotation.Reference;
   import com.company.spring.boot.shardingsphere.seata.modules.entity.OrderEntity;
   import com.company.spring.boot.shardingsphere.seata.modules.service.IBusinessService;
   import com.company.spring.boot.shardingsphere.seata.modules.service.IOrderService;
   import io.seata.core.context.RootContext;
   import io.seata.spring.annotation.GlobalTransactional;
   import org.apache.shardingsphere.transaction.annotation.ShardingTransactionType;
   import org.apache.shardingsphere.transaction.core.TransactionType;
   import org.apache.shardingsphere.transaction.core.TransactionTypeHolder;
   import org.springframework.stereotype.Service;
   
   @Service
   public class BusinessServiceImpl implements IBusinessService {
   
       @Reference(check = false,mock = "com.company.spring.boot.shardingsphere.seata.modules.mock.IOrderServiceMock")
       IOrderService orderService;
   
       @Override
       @GlobalTransactional(name = "dubbo-purchase")
       public void purchase(){
           TransactionTypeHolder.set(TransactionType.BASE);
           OrderEntity orderEntity = new OrderEntity();
           orderEntity.setOrderId(123);
           orderEntity.setStatus("seata");
           orderEntity.setUserId(123);
           orderService.insertOrder(orderEntity);
           System.out.println("XID:"+ RootContext.getXID());
           throw new RuntimeException("回滚测试");
       }
   }
   
   @GlobalTransactional 
   ![image](https://user-images.githubusercontent.com/15086151/63149520-028c6380-c037-11e9-9456-2402ab918e77.png)
   GlobalTransactionScanner Class has been delete initClient Function
   
   
   The query log found that consumer had printed 
   ![image](https://user-images.githubusercontent.com/15086151/63149281-32873700-c036-11e9-8d73-34feecda6d73.png)
   
   But the provider did not roll back the message
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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