ByteTCC

ByteTCC is a distributed transaction manager based on the TCC(Try/Confirm/Cancel) mechanism. It’s compatible with the JTA specification. User guide: https://github.com/liuyangming/ByteTCC/wiki

Github星跟踪图


ByteTCC is an implementation of Distributed Transaction Manager, based on Try-Confirm-Cancel (TCC) mechanism.

ByteTCC is comptible with JTA and could be seamlessly integrated with Spring and other Java containers.

1. Quick Start

1.1 Add maven depenency

1.1.1. Spring Cloud
<dependency>
	<groupId>org.bytesoft</groupId>
	<artifactId>bytetcc-supports-springcloud</artifactId>
	<version>0.5.10</version>
</dependency>
1.1.2. dubbo
<dependency>
	<groupId>org.bytesoft</groupId>
	<artifactId>bytetcc-supports-dubbo</artifactId>
	<version>0.5.10</version>
</dependency>

1.2 Compose a business service

@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);
	}

}

1.3 Compose a confirm service

@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);
	}

}

1.4 Compose a cancel service

@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);
	}

}

2. Documentation & Samples

3. Features

  • support declarative transaction management
  • support normal transaction, TCC transaction, compensating service transaction
  • support distributed transaction scenarios. e.g. multi-datasource, cross-applications and cross-servers transaction
  • support long live transaction
  • support Dubbo framework
  • support Spring Cloud
  • provide solutions for service idempotence in framework layer

4. Contact Me

If you have any questions or comments regarding this project, please feel free to contact me at:

  1. send mail to bytefox#126.com
    ~OR~
  2. add Tecent QQ group 537445956/606453172/383515467

We will review all the suggestions and implement good ones in future release.

主要指标

概览
名称与所有者liuyangming/ByteTCC
主编程语言Java
编程语言Java (语言数: 1)
平台
许可证GNU Lesser General Public License v3.0
所有者活动
创建于2016-02-12 11:51:14
推送于2022-04-15 13:50:00
最后一次提交2022-04-15 21:50:00
发布数24
最新版本名称0.5.3 (发布于 )
第一版名称0.3.0-alpha (发布于 2016-11-15 18:15:29)
用户参与
星数2.9k
关注者数255
派生数0.9k
提交数554
已启用问题?
问题数149
打开的问题数101
拉请求数2
打开的拉请求数0
关闭的拉请求数2
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?