{"id":13435689,"url":"https://github.com/liuyangming/ByteTCC","last_synced_at":"2025-03-18T11:31:58.881Z","repository":{"id":41380825,"uuid":"51584462","full_name":"liuyangming/ByteTCC","owner":"liuyangming","description":"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","archived":false,"fork":false,"pushed_at":"2022-04-15T13:50:00.000Z","size":1693,"stargazers_count":2895,"open_issues_count":101,"forks_count":911,"subscribers_count":255,"default_branch":"master","last_synced_at":"2025-03-15T22:52:17.063Z","etag":null,"topics":["distributed-transaction","dubbo","jta","spring-cloud","tcc","transaction"],"latest_commit_sha":null,"homepage":"https://www.bytesoft.org/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liuyangming.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://raw.githubusercontent.com/wiki/liuyangming/ByteTCC/resources/donation/liuyangming%40alipay.png","https://raw.githubusercontent.com/wiki/liuyangming/ByteTCC/resources/donation/liuyangming%40weixin.png"]}},"created_at":"2016-02-12T11:51:14.000Z","updated_at":"2025-03-01T09:54:13.000Z","dependencies_parsed_at":"2022-07-26T08:02:09.948Z","dependency_job_id":null,"html_url":"https://github.com/liuyangming/ByteTCC","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyangming%2FByteTCC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyangming%2FByteTCC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyangming%2FByteTCC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyangming%2FByteTCC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liuyangming","download_url":"https://codeload.github.com/liuyangming/ByteTCC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244211127,"owners_count":20416584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-transaction","dubbo","jta","spring-cloud","tcc","transaction"],"created_at":"2024-07-31T03:00:38.098Z","updated_at":"2025-03-18T11:31:53.873Z","avatar_url":"https://github.com/liuyangming.png","language":"Java","readme":"﻿ByteTCC是一个基于TCC（Try/Confirm/Cancel）机制的分布式事务管理器。兼容JTA，可以很好的与EJB、Spring等容器（本文档下文说明中将以Spring容器为例）进行集成。\n\n## 一、快速入门\n#### 1.1. 加入maven依赖\n###### 1.1.1. 使用Spring Cloud\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003eorg.bytesoft\u003c/groupId\u003e\n\t\u003cartifactId\u003ebytetcc-supports-springcloud\u003c/artifactId\u003e\n\t\u003cversion\u003e0.5.12\u003c/version\u003e\n\u003c/dependency\u003e\n```\n###### 1.1.2. 使用dubbo\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003eorg.bytesoft\u003c/groupId\u003e\n\t\u003cartifactId\u003ebytetcc-supports-dubbo\u003c/artifactId\u003e\n\t\u003cversion\u003e0.5.12\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### 1.2. 编写业务服务\n```java\n@Service(\"accountService\")\n@Compensable(\n  interfaceClass = IAccountService.class \n, confirmableKey = \"accountServiceConfirm\"\n, cancellableKey = \"accountServiceCancel\"\n)\npublic class AccountServiceImpl implements IAccountService {\n\n\t@Resource(name = \"jdbcTemplate\")\n\tprivate JdbcTemplate jdbcTemplate;\n\n\t@Transactional\n\tpublic void increaseAmount(String accountId, double amount) throws ServiceException {\n\t    this.jdbcTemplate.update(\"update tb_account set frozen = frozen + ? where acct_id = ?\", amount, acctId);\n\t}\n\n}\n```\n\n#### 1.3. 编写confirm服务\n```java\n@Service(\"accountServiceConfirm\")\npublic class AccountServiceConfirm implements IAccountService {\n\n\t@Resource(name = \"jdbcTemplate\")\n\tprivate JdbcTemplate jdbcTemplate;\n\n\t@Transactional\n\tpublic void increaseAmount(String accountId, double amount) throws ServiceException {\n\t    this.jdbcTemplate.update(\"update tb_account set amount = amount + ?, frozen = frozen - ? where acct_id = ?\", amount, amount, acctId);\n\t}\n\n}\n```\n\n#### 1.4. 编写cancel服务\n```java\n@Service(\"accountServiceCancel\")\npublic class AccountServiceCancel implements IAccountService {\n\n\t@Resource(name = \"jdbcTemplate\")\n\tprivate JdbcTemplate jdbcTemplate;\n\n\t@Transactional\n\tpublic void increaseAmount(String accountId, double amount) throws ServiceException {\n\t    this.jdbcTemplate.update(\"update tb_account set frozen = frozen - ? where acct_id = ?\", amount, acctId);\n\t}\n\n}\n```\n\n## 二、文档 \u0026 样例\n* 使用文档： https://github.com/liuyangming/ByteTCC/wiki\n* 使用样例： https://github.com/liuyangming/ByteTCC-sample\n\n\n## 三、ByteTCC特性\n* 1、支持Spring容器的声明式事务管理；\n* 2、支持普通事务、TCC事务、saga事务等事务机制；\n* 3、支持多数据源、跨应用、跨服务器等分布式事务场景；\n* 4、支持长事务；\n* 5、支持dubbo服务框架；\n* 6、支持spring cloud；\n* 7、提供框架层面的幂等性保障；\n\n## 四、历史版本\n#### 4.1. v0.3.x\n* 地址：https://github.com/liuyangming/ByteTCC/tree/0.3.x\n* 文档：https://github.com/liuyangming/ByteTCC/wiki\n\n#### 4.2. v0.2.0-alpha\n* 地址：http://code.taobao.org/p/openjtcc\n* 文档：http://code.taobao.org/p/openjtcc/wiki/index/\n\n#### 4.3. v0.1.2\n* 地址：http://code.google.com/p/bytetcc\n\n#### 4.4. v0.1\n* 地址：http://pan.baidu.com/s/1hq3ffxU\n\n## 五、建议及改进\n若您有任何建议，可以通过1）加入qq群537445956/606453172/383515467向群主提出，或2）发送邮件至bytefox#126.com向我反馈。本人承诺，任何建议都将会被认真考虑，优秀的建议将会被采用，但不保证一定会在当前版本中实现。\n","funding_links":["https://raw.githubusercontent.com/wiki/liuyangming/ByteTCC/resources/donation/liuyangming%40alipay.png","https://raw.githubusercontent.com/wiki/liuyangming/ByteTCC/resources/donation/liuyangming%40weixin.png"],"categories":["数据库开发","Java","中间件","四、中间件"],"sub_categories":["4.1 ByteTCC"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyangming%2FByteTCC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliuyangming%2FByteTCC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyangming%2FByteTCC/lists"}