ByteTCC是一个基于TCC(Try/Cofirm/Cacel)机制的分布式事务管理器。兼容JTA,可以很好的与Sprig容器进行集成。
一、快速入门1.1.加入mave依赖1.1.1.使用SprigCloud<depedecy><groupId>org.bytesoft</groupId><artifactId>bytetcc-supports-sprigcloud</artifactId><versio>0.4.0-rc1</versio></depedecy>1.1.1.使用Dubbo<depedecy><groupId>org.bytesoft</groupId><artifactId>bytetcc-supports-dubbo</artifactId><versio>0.4.0-rc1</versio></depedecy>1.2.编写业务服务@Service("accoutService")@Compesable( iterfaceClass = IAccoutService.class, cofirmableKey = "accoutServiceCofirm", cacellableKey = "accoutServiceCacel")public class AccoutServiceImpl implemets IAccoutService { @Resource(ame = "jdbcTemplate") private JdbcTemplate jdbcTemplate; @Trasactioal public void icreaseAmout(Strig accoutId, double amout) throws ServiceExceptio { this.jdbcTemplate.update("update tb_accout set froze = froze + ? where acct_id = ?", amout, acctId); }}1.3.编写cofirm服务@Service("accoutServiceCofirm")public class AccoutServiceCofirm implemets IAccoutService { @Resource(ame = "jdbcTemplate") private JdbcTemplate jdbcTemplate; @Trasactioal public void icreaseAmout(Strig accoutId, double amout) throws ServiceExceptio { this.jdbcTemplate.update("update tb_accout set amout = amout + ?, froze = froze - ? where acct_id = ?", amout, amout, acctId); }}1.4.编写cacel服务@Service("accoutServiceCacel")public class AccoutServiceCacel implemets IAccoutService { @Resource(ame = "jdbcTemplate") private JdbcTemplate jdbcTemplate; @Trasactioal public void icreaseAmout(Strig accoutId, double amout) throws ServiceExceptio { this.jdbcTemplate.update("update tb_accout set froze = froze - ? where acct_id = ?", amout, acctId); }}二、文档&样例*使用文档:https://github.com/liuyagmig/ByteTCC/wiki*使用样例:https://github.com/liuyagmig/ByteTCC-sample
三、ByteTCC特性*1、支持Sprig容器的声明式事务管理;*2、支持普通事务、TCC事务、业务补偿型事务等事务机制;*3、支持多数据源、跨应用、跨服务器等分布式事务场景;*4、支持长事务;*5、支持dubbo服务框架;*6、支持sprig-cloud;
四、服务质量4.1.故障恢复任意时刻因任意故障(包括但不限于:业务系统/RDBS服务器宕机;网络故障;断电等)造成的事务中断,ByteTCC均有相应机制予以恢复,保证全局事务的最终一致性。
4.2.幂等性ByteTCC在框架层面提供对Cofirm/Cacel业务逻辑的幂等性保障,业务系统仅需关注自身业务本身,无需为幂等性问题而烦恼。
五、建议及改进若您有任何建议,可以通过1)加入qq群537445956/606453172向群主提出,或2)发送邮件至bytefox@126.com向我反馈。本人承诺,任何建议都将会被认真考虑,优秀的建议将会被采用,但不保证一定会在当前版本中实现。










评论