{"id":26874334,"url":"https://github.com/wayshall/onetwo-tcc","last_synced_at":"2026-02-17T08:36:55.332Z","repository":{"id":146571145,"uuid":"216783834","full_name":"wayshall/onetwo-tcc","owner":"wayshall","description":"一个简单的tcc事务框架","archived":false,"fork":false,"pushed_at":"2025-04-05T02:44:04.000Z","size":150,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T11:51:41.292Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wayshall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-22T10:13:51.000Z","updated_at":"2024-08-14T03:15:42.000Z","dependencies_parsed_at":"2024-08-26T12:05:29.927Z","dependency_job_id":"bab83e0e-c50a-4bb5-8ceb-8ad81259a05c","html_url":"https://github.com/wayshall/onetwo-tcc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wayshall/onetwo-tcc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayshall%2Fonetwo-tcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayshall%2Fonetwo-tcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayshall%2Fonetwo-tcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayshall%2Fonetwo-tcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wayshall","download_url":"https://codeload.github.com/wayshall/onetwo-tcc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayshall%2Fonetwo-tcc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29537875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T08:11:05.436Z","status":"ssl_error","status_checked_at":"2026-02-17T08:09:38.860Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-03-31T09:36:28.468Z","updated_at":"2026-02-17T08:36:55.307Z","avatar_url":"https://github.com/wayshall.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# onetwo-tcc\n一个简单的tcc事务框架\n\n## 要求\n- JDK 1.8+\n- Spring 4.0+\n- RocketMQ 3.x + \n- Spring Boot 1.4.x, 1.5.x\n\n\n\n## maven\n\n**当前snapshot版本：0.5.1-SNAPSHOT**\n\n若使用snapshot版本，请添加snapshotRepository仓储：\n\n```xml\n\u003crepository\u003e\n     \u003cid\u003eoss\u003c/id\u003e\n     \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots/\u003c/url\u003e\n    \u003csnapshots\u003e\n        \u003cenabled\u003etrue\u003c/enabled\u003e\n    \u003c/snapshots\u003e\n\u003c/repository\u003e   \n```\n\n\n\n其它依赖可以直接参考sample项目的pom.xml配置\n\n\n\n\n## 使用\n\n### 启用注解\n要使用tcc功能，首先要使用 @EnableTCC 注解，激活加载tcc相关组件\n\n```Java\n@SpringBootApplication\n@EnableTCC\npublic class TccServiceApplication {\n\tpublic static void main(String[] args) {\n\t\tSpringApplication.run(TccOrderServiceApplication.class, args);\n\t}\n}\n```\n\n\n\n###  tcc事务注解使用\n\n0、使用@TCCService注解标记服务类为Tcc服务类\n\n```Java\n@Service\n@TCCService\npublic class TccService {\n}\n```\n\n\n\n1、标记主事务方法：\n\n```Java\n\n@Service\n@TCCService\npublic class TccService {\n    @TCCTransactional(globalized=true)\n    public void tccMain() {\n    }\n}\n```\n\n2、标记分支事务方法：\n\n```java\n\n@Service\n@TCCService\npublic class BranchTccService {\n    @TCCTransactional(globalized=false, confirmMethod=\"确认方法名称\", cancelMethod=\"取消方法名称\")\n    public void tccBranch() {\n    }\n}\n```\n\n**注意 **\n\n- 分支事务方法不需要加事务注解，tcc框架内部已自动包装了事务\n\n\n\n3、confirm和cancel方法签名必须与try方法一致，且在同一个类\n\n```Java\n\t\n@Service\n@TCCService\npublic class BranchTccService {\n    @TCCTransactional(globalized=false, confirmMethod=\"confirm\", cancelMethod=\"cancel\")\n    public void try(Request request) {\n    }\n\n    public void confirm(Request request) {\n    }\n\n    public void cancel(Request request) {\n    }\n}\n```\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayshall%2Fonetwo-tcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwayshall%2Fonetwo-tcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayshall%2Fonetwo-tcc/lists"}