lovegames opened a new issue #11788:
URL: https://github.com/apache/shardingsphere/issues/11788
## Question
When using distributed transaction, the feign call threw an exception, but
the transaction did not roll back properly. It is suspected that the code
entered fallback, so the transaction could not be rolled back properly. Is
there any good solution
`@ShardingTransactionType(value = TransactionType.XA)
@Transactional(rollbackFor = Exception.class)
@Override
public Integer testTransactionXA(User user) {
userMapper.insert(user);
SysOrganizationDto dto = new SysOrganizationDto();
dto.setName("测试事务");
sysOrganizationFeign.insert(dto);
userMapper.insert(user);
return null;
}
@Component
@Slf4j
public class SysOrganizationFallBackFactory implements
FallbackFactory<SysOrganziationApi> {
@Override
public SysOrganziationApi create(Throwable throwable) {
log.error("SysOrganizationFallBackFactory error: ", throwable);
return new SysOrganziationApi() {
@Override
public Long insert(SysOrganizationDto dto) {
return null;
}
}
`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]