ByteTCC 是一个基于TCC(Try/Confirm/Cancel)机制的分布式事务管理器。它兼容JTA规范。用户指南:https://git
ByteTCC 是一个基于TCC(Try/Confirm/Cancel)机制的分布式事务管理器。它兼容JTA规范。用户指南:https://git
ByteTCC 是一个基于 Try-Confirm-Cancel(TCC)机制的分布式事务管理器实现。
ByteTCC 兼容 JTA,并且可以与 Spring 及其他 Java 容器无缝集成。
<dependency>
<groupId>org.bytesoft</groupId>
<artifactId>bytetcc-supports-springcloud</artifactId>
<version>0.5.12</version>
</dependency><dependency>
<groupId>org.bytesoft</groupId>
<artifactId>bytetcc-supports-dubbo</artifactId>
<version>0.5.12</version>
</dependency>@Service("accountService")
@Compensable(
interfaceClass = IAccountService.class
, confirmableKey = "accountServiceConfirm"
, cancellableKey = "accountServiceCancel"
)
public class AccountServiceImpl implements IAccountService {
@Resource(name = "jdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Transactional
public void increaseAmount(String accountId, double amount) throws ServiceException {
this.jdbcTemplate.update("update tb_account set frozen = frozen + ? where acct_id = ?", amount, acctId);
}
}@Service("accountServiceConfirm")
public class AccountServiceConfirm implements IAccountService {
@Resource(name = "jdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Transactional
public void increaseAmount(String accountId, double amount) throws ServiceException {
this.jdbcTemplate.update("update tb_account set amount = amount + ?, frozen = frozen - ? where acct_id = ?", amount, amount, acctId);
}
}@Service("accountServiceCancel")
public class AccountServiceCancel implements IAccountService {
@Resource(name = "jdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Transactional
public void increaseAmount(String accountId, double amount) throws ServiceException {
this.jdbcTemplate.update("update tb_account set frozen = frozen - ? where acct_id = ?", amount, acctId);
}
}暂无开放 Issues,或尚未同步最近议题。