You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 10 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <div style="align: center">
  16. <img src="https://img.alicdn.com/imgextra/i1/O1CN011z0JfQ2723QgDiWuH_!!6000000007738-2-tps-1497-401.png" height="100" width="426"/>
  17. </div>
  18. # Seata-go: Simple Extensible Autonomous Transaction Architecture(Go version)
  19. [![CI](https://github.com/apache/incubator-seata-go/actions/workflows/build.yml/badge.svg)](https://github.com/apache/incubator-seata-go/actions/workflows/build.yml) [![license](https://img.shields.io/github/license/apache/incubator-seata-go.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![codecov](https://codecov.io/gh/apache/incubator-seata-go/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/incubator-seata-go) [简体中文 ZH](./README_ZH.md)
  20. ## What is Seata-go?
  21. Apache Seata(incubating) is a very mature distributed transaction framework, and is the de facto standard platform for distributed transaction technology in the Java field. Seata-go is the implementation version of go language in Seata multilingual ecosystem, which realizes the interoperability between Java and Go, so that Go developers can also use seata-go to realize distributed transactions. Please visit the [official website of Seata](https://seata.apache.org/) to view the quick start and documentation.
  22. The principle of seata-go is consistent with that of Seata-java, which is composed of TM, RM and TC. The functions of TC are reused in Java, and the functions of TM and RM have been connected with Seata-java.
  23. ### Distributed Transaction Problem in Microservices
  24. Let's imagine a traditional monolithic application. Its business is built up with 3 modules. They use a single local data source.
  25. Naturally, data consistency will be guaranteed by the local transaction.
  26. ![Monolithic App](https://img.alicdn.com/imgextra/i3/O1CN01FTtjyG1H4vvVh1sNY_!!6000000000705-0-tps-1106-678.jpg)
  27. Things have changed in a microservices architecture. The 3 modules mentioned above are designed to be 3 services on top of 3 different data sources ([Pattern: Database per service](http://microservices.io/patterns/data/database-per-service.html)). Data consistency within every single service is naturally guaranteed by the local transaction.
  28. **But how about the whole business logic scope?**
  29. ![Microservices Problem](https://img.alicdn.com/imgextra/i1/O1CN01DXkc3o1te9mnJcHOr_!!6000000005926-0-tps-1268-804.jpg)
  30. ### How Seata-go do?
  31. Seata-go is just a solution to the problem mentioned above.
  32. ![Seata solution](https://img.alicdn.com/imgextra/i1/O1CN01FheliH1k5VHIRob3p_!!6000000004632-0-tps-1534-908.jpg)
  33. Firstly, how to define a **Distributed Transaction**?
  34. We say, a **Distributed Transaction** is a **Global Transaction** which is made up with a batch of **Branch Transaction**, and normally **Branch Transaction** is just **Local Transaction**.
  35. ![Global & Branch](https://cdn.nlark.com/lark/0/2018/png/18862/1545015454979-a18e16f6-ed41-44f1-9c7a-bd82c4d5ff99.png)
  36. There are three roles in Seata-go:
  37. - **Transaction Coordinator(TC):** Maintain status of global and branch transactions, drive the global commit or rollback.
  38. - **Transaction Manager(TM):** Define the scope of global transaction: begin a global transaction, commit or rollback a global transaction.
  39. - **Resource Manager(RM):** Manage resources that branch transactions working on, talk to TC for registering branch transactions and reporting status of branch transactions, and drive the branch transaction commit or rollback.
  40. ![Model](https://cdn.nlark.com/lark/0/2018/png/18862/1545013915286-4a90f0df-5fda-41e1-91e0-2aa3d331c035.png)
  41. A typical lifecycle of Seata-go managed distributed transaction:
  42. 1. TM asks TC to begin a new global transaction. TC generates an XID representing the global transaction.
  43. 2. XID is propagated through microservices' invoke chain.
  44. 3. RM registers local transaction as a branch of the corresponding global transaction of XID to TC.
  45. 4. TM asks TC for committing or rollbacking the corresponding global transaction of XID.
  46. 5. TC drives all branch transactions under the corresponding global transaction of XID to finish branch committing or rollbacking.
  47. ![Typical Process](https://cdn.nlark.com/lark/0/2018/png/18862/1545296917881-26fabeb9-71fa-4f3e-8a7a-fc317d3389f4.png)
  48. For more details about principle and design, please go to [Seata wiki page](https://github.com/apache/incubator-seata/wiki).
  49. ### History
  50. ##### Alibaba
  51. - **TXC**: Taobao Transaction Constructor. Alibaba middleware team started this project since 2014 to meet the distributed transaction problems caused by application architecture change from monolithic to microservices.
  52. - **GTS**: Global Transaction Service. TXC as an Aliyun middleware product with new name GTS was published since 2016.
  53. - **Fescar**: we started the open source project Fescar based on TXC/GTS since 2019 to work closely with the community in the future.
  54. ##### Ant Financial
  55. - **XTS**: Extended Transaction Service. Ant Financial middleware team developed the distributed transaction middleware since 2007, which is widely used in Ant Financial and solves the problems of data consistency across databases and services.
  56. - **DTX**: Distributed Transaction Extended. Since 2013, XTS has been published on the Ant Financial Cloud, with the name of DTX .
  57. ##### Seata Community
  58. - **Seata** :Simple Extensible Autonomous Transaction Architecture. Ant Financial joins Fescar, which make it to be a more neutral and open community for distributed transaction, and Fescar be renamed to Seata.
  59. ## How to run?
  60. ```go
  61. go get seata.apache.org/seata-go@v2.0.0
  62. ```
  63. if you want to know how to use and integrate seata-go, please refer to [apache/seata-go-samples](https://github.com/apache/incubator-seata-go-samples)
  64. ## How to find the latest version
  65. Visit Seata-Go's GitHub Releases page
  66. Open:
  67. https://github.com/seata/seata-go/releases
  68. The latest tag / release is the latest stable version.
  69. ## Documentation
  70. You can view the full documentation from Seata Official Website: [Seata Website page](https://seata.apache.org/zh-cn/docs/overview/what-is-seata).
  71. ## Reporting bugs
  72. Please follow the [template](.github/ISSUE_TEMPLATE/BUG_REPORT_TEMPLATE.md) for reporting any issues.
  73. ## Security
  74. Please do not use our public issue tracker but refer to our [security policy](https://github.com/apache/incubator-seata/blob/2.x/SECURITY.md)
  75. ## Contributing
  76. Seata-go is currently in the construction stage. Welcome colleagues in the industry to join the group and work with us to promote the construction of seata-go! If you want to contribute code to seata-go, you can refer to the [**code contribution Specification**](./CONTRIBUTING_CN.md) document to understand the specifications of the community, or you can join our community DingTalk group: 33069364 and communicate together!
  77. ## Contact
  78. * Mailing list:
  79. * dev@seata.apache.org , for dev/user discussion. [subscribe](mailto:dev-subscribe@seata.apache.org), [unsubscribe](mailto:dev-unsubscribe@seata.apache.org), [archive](https://lists.apache.org/list.html?dev@seata.apache.org)
  80. * Online chat:
  81. | Dingtalk group | Wechat official account | QQ group | Wechat assistant |
  82. |:---------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------:|
  83. | <img src="https://seata.apache.org/zh-cn/assets/images/dingtalk-group-67f42c9466fb2268b6927bb16b549d6c.jpg" width="150" /> | <img src="https://seata.apache.org/zh-cn/assets/images/wechat-official-467d10305f5449e6b2096e65d23a9d02.jpg" width="150" /> | <img src="https://seata.apache.org/zh-cn/assets/images/qq-group-8d8a89699cdb9ba8818364069475ba96.jpg" width="150" /> | <img src="https://seata.apache.org/zh-cn/assets/images/wechat-f8a87a96973942b826e32d1aed9bc8d9.jpg" width="150" /> |
  84. ## Seata ecosystem
  85. * [Seata Website](https://github.com/apache/incubator-seata.github.io) - Seata official website
  86. * [Seata](https://github.com/apache/incubator-seata)- Seata client and server
  87. * [Seata GoLang](https://github.com/apache/incubator-seata-go) - Seata GoLang client and server
  88. * [Seata Samples](https://github.com/apache/incubator-seata-samples) - Samples for Seata
  89. * [Seata GoLang Samples](https://github.com/apache/incubator-seata-go-samples) - Samples for Seata GoLang
  90. * [Seata K8s](https://github.com/apache/incubator-seata-k8s) - Seata integration with k8s
  91. * [Seata CLI](https://github.com/apache/incubator-seata-ctl) - CLI tool for Seata
  92. ## Contributors
  93. This project exists thanks to all the people who contribute. [[Contributors](https://github.com/apache/incubator-seata-go/graphs/contributors)].
  94. ## License
  95. Seata-go is under the Apache 2.0 license. See the [LICENSE](https://github.com/apache/incubator-seata-go/blob/master/LICENSE) file for details.