From d129ae80fb11a607f1cb6b80fc108aaf48c93097 Mon Sep 17 00:00:00 2001 From: xudeyou Date: Sun, 17 Feb 2019 09:10:26 +0800 Subject: [PATCH] feat: SpringCloud F version and Spring Boot 2.0.x support --- easytrans-core/pom.xml | 28 +++++++++++++--- easytrans-demo/interface-call/pom.xml | 10 +----- easytrans-demo/rpc-dubbo/pom.xml | 10 +----- easytrans-demo/sagatcc/pom.xml | 10 +----- easytrans-demo/tcc-and-fescar/pom.xml | 33 ++++++++++++------- .../tccandfescar-coupon-service/pom.xml | 5 +++ .../tccandfescar-order-service/pom.xml | 5 +++ .../tccandfescar-wallet-service/pom.xml | 5 +++ easytrans-demo/tcc-and-msg/pom.xml | 10 +----- easytrans-demo/tcc-only/pom.xml | 10 +----- .../tcc-only/tcconly-order-service/pom.xml | 1 + easytrans-log-database-starter/pom.xml | 2 +- easytrans-rpc-rest-ribbon-starter/pom.xml | 4 +-- pom.xml | 25 +++++++++++--- readme-en.md | 3 ++ readme.md | 22 +++++++++---- 16 files changed, 107 insertions(+), 76 deletions(-) diff --git a/easytrans-core/pom.xml b/easytrans-core/pom.xml index a749cae..addbc13 100644 --- a/easytrans-core/pom.xml +++ b/easytrans-core/pom.xml @@ -66,12 +66,30 @@ - - org.apache.curator - curator-recipes - + + org.apache.curator + curator-recipes - + + + org.apache.zookeeper + zookeeper + + + + + + org.apache.zookeeper + zookeeper + + + org.slf4j + slf4j-log4j12 + + + + + com.google.guava guava diff --git a/easytrans-demo/interface-call/pom.xml b/easytrans-demo/interface-call/pom.xml index 1a3b906..536913b 100644 --- a/easytrans-demo/interface-call/pom.xml +++ b/easytrans-demo/interface-call/pom.xml @@ -19,7 +19,7 @@ UTF-8 UTF-8 1.8 - 1.1.3 + 1.2.0 @@ -32,14 +32,6 @@ - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR5 - pom - import - - com.yiqiniu.easytrans easytrans diff --git a/easytrans-demo/rpc-dubbo/pom.xml b/easytrans-demo/rpc-dubbo/pom.xml index 11c0a3c..f6e46cf 100644 --- a/easytrans-demo/rpc-dubbo/pom.xml +++ b/easytrans-demo/rpc-dubbo/pom.xml @@ -19,7 +19,7 @@ UTF-8 UTF-8 1.8 - 1.1.3 + 1.2.0 @@ -32,14 +32,6 @@ - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR5 - pom - import - - com.yiqiniu.easytrans easytrans diff --git a/easytrans-demo/sagatcc/pom.xml b/easytrans-demo/sagatcc/pom.xml index 1fe0279..9386200 100644 --- a/easytrans-demo/sagatcc/pom.xml +++ b/easytrans-demo/sagatcc/pom.xml @@ -19,7 +19,7 @@ UTF-8 UTF-8 1.8 - 1.1.3 + 1.2.0 @@ -32,14 +32,6 @@ - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR5 - pom - import - - com.yiqiniu.easytrans easytrans diff --git a/easytrans-demo/tcc-and-fescar/pom.xml b/easytrans-demo/tcc-and-fescar/pom.xml index e350ded..707caeb 100644 --- a/easytrans-demo/tcc-and-fescar/pom.xml +++ b/easytrans-demo/tcc-and-fescar/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.13.RELEASE + 2.0.8.RELEASE 4.0.0 @@ -34,22 +34,26 @@ - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR5 - pom - import - + + org.springframework.cloud + spring-cloud-dependencies + Finchley.SR2 + pom + import + com.yiqiniu.easytrans - easytrans + easytrans-starter ${revision} - pom - import + + com.yiqiniu.easytrans + easytrans-core + ${revision} + + com.yiqiniu.easytrans.demos tccandfescar-wallet-api @@ -78,6 +82,13 @@ tccandfescar-order-service ${revision} + + + mysql + mysql-connector-java + 5.1.46 + + diff --git a/easytrans-demo/tcc-and-fescar/tccandfescar-coupon-service/pom.xml b/easytrans-demo/tcc-and-fescar/tccandfescar-coupon-service/pom.xml index 0fc84d8..1bb0d33 100644 --- a/easytrans-demo/tcc-and-fescar/tccandfescar-coupon-service/pom.xml +++ b/easytrans-demo/tcc-and-fescar/tccandfescar-coupon-service/pom.xml @@ -45,6 +45,11 @@ mysql mysql-connector-java + + + org.springframework.cloud + spring-cloud-starter-netflix-ribbon + diff --git a/easytrans-demo/tcc-and-fescar/tccandfescar-order-service/pom.xml b/easytrans-demo/tcc-and-fescar/tccandfescar-order-service/pom.xml index f627b5e..9964fad 100644 --- a/easytrans-demo/tcc-and-fescar/tccandfescar-order-service/pom.xml +++ b/easytrans-demo/tcc-and-fescar/tccandfescar-order-service/pom.xml @@ -55,6 +55,11 @@ org.apache.httpcomponents httpclient + + + org.springframework.cloud + spring-cloud-starter-netflix-ribbon + diff --git a/easytrans-demo/tcc-and-fescar/tccandfescar-wallet-service/pom.xml b/easytrans-demo/tcc-and-fescar/tccandfescar-wallet-service/pom.xml index bf8e032..8fc733a 100644 --- a/easytrans-demo/tcc-and-fescar/tccandfescar-wallet-service/pom.xml +++ b/easytrans-demo/tcc-and-fescar/tccandfescar-wallet-service/pom.xml @@ -45,6 +45,11 @@ mysql mysql-connector-java + + + org.springframework.cloud + spring-cloud-starter-netflix-ribbon + diff --git a/easytrans-demo/tcc-and-msg/pom.xml b/easytrans-demo/tcc-and-msg/pom.xml index ef403d9..06712d2 100644 --- a/easytrans-demo/tcc-and-msg/pom.xml +++ b/easytrans-demo/tcc-and-msg/pom.xml @@ -19,7 +19,7 @@ UTF-8 UTF-8 1.8 - 1.1.3 + 1.2.0 @@ -34,14 +34,6 @@ - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR5 - pom - import - - com.yiqiniu.easytrans easytrans diff --git a/easytrans-demo/tcc-only/pom.xml b/easytrans-demo/tcc-only/pom.xml index c8c3d3a..3066698 100644 --- a/easytrans-demo/tcc-only/pom.xml +++ b/easytrans-demo/tcc-only/pom.xml @@ -19,7 +19,7 @@ UTF-8 UTF-8 1.8 - 1.1.3 + 1.2.0 @@ -31,14 +31,6 @@ - - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR5 - pom - import - com.yiqiniu.easytrans diff --git a/easytrans-demo/tcc-only/tcconly-order-service/pom.xml b/easytrans-demo/tcc-only/tcconly-order-service/pom.xml index 1962790..99934e7 100644 --- a/easytrans-demo/tcc-only/tcconly-order-service/pom.xml +++ b/easytrans-demo/tcc-only/tcconly-order-service/pom.xml @@ -36,6 +36,7 @@ tcconly-wallet-api + org.springframework.boot spring-boot-starter-jdbc diff --git a/easytrans-log-database-starter/pom.xml b/easytrans-log-database-starter/pom.xml index a9762b8..d19c16f 100644 --- a/easytrans-log-database-starter/pom.xml +++ b/easytrans-log-database-starter/pom.xml @@ -24,7 +24,7 @@ com.alibaba druid - 1.1.5 + 1.1.13 diff --git a/easytrans-rpc-rest-ribbon-starter/pom.xml b/easytrans-rpc-rest-ribbon-starter/pom.xml index 2fbd09c..ee37513 100644 --- a/easytrans-rpc-rest-ribbon-starter/pom.xml +++ b/easytrans-rpc-rest-ribbon-starter/pom.xml @@ -26,10 +26,10 @@ spring-boot-starter-web - + org.springframework.cloud spring-cloud-starter-ribbon - + diff --git a/pom.xml b/pom.xml index 045a88f..f6b3343 100644 --- a/pom.xml +++ b/pom.xml @@ -59,23 +59,21 @@ - + org.springframework.boot spring-boot-starter-parent 1.5.6.RELEASE - - + org.springframework.cloud spring-cloud-dependencies Dalston.SR5 - pom import - + com.yiqiniu.easytrans @@ -125,6 +123,23 @@ ${revision} + + org.apache.curator + curator-recipes + 4.0.1 + + + + org.apache.curator + curator-framework + 4.0.1 + + + + org.apache.zookeeper + zookeeper + 3.4.10 + diff --git a/readme-en.md b/readme-en.md index 0992f8d..bf4d5a1 100644 --- a/readme-en.md +++ b/readme-en.md @@ -1,3 +1,6 @@ +This article a bit outofdate, some new function has been added , you can refer readme.md in Chinese for news, or you can submit an issue to let me know you want me to update this article + + # English (English is not my native language, can someone help me to review the text below?) diff --git a/readme.md b/readme.md index 8c7db69..67fe091 100644 --- a/readme.md +++ b/readme.md @@ -43,7 +43,7 @@ * 适用于需要获取远程执行结果来决定逻辑事务走向 且 可以进行补偿的业务 * 若使用消息队列不能解决的事务问题优先考虑使用基于补偿的最终一致性事务(若需要嵌套事务,则使用TCC) * 本框架中传统补偿不支持嵌套,若有需要,可改用TCC -* 使用自动补偿完成的最终一致性事务(参考阿里Fescar的AT模式,目前处于Alpha状态,仅供熟悉原理代码能自行排坑者使用) +* 使用自动补偿完成的最终一致性事务(整合改造阿里的Fescar的AT模式完成) * 适用于需要获取远程执行结果来决定逻辑事务走向 且 不介意偶尔读取并展示脏数据的场景 * 该模式下,普通select时数据整体处于脏读状态,进行本地更新事务时,若进行逻辑判断所需的字段会参与到全局事务时,需要用Select for update获取准确值后再判断 * 因上述全局事务及本地事务的协作是一个隐式、易错点,甚至于写每一个涉及更新的SQL都需要考虑上面这个因素,因此希望引入并使用自动补偿时,需建立好相关使用规范,以避免后续项目失控 @@ -96,11 +96,9 @@ com.yiqiniu.easytrans easytrans-starter - 1.2.0-beta + 1.2.0 -目前稳定版本为 1.1.3,生产请使用该版本 - Starter里包含了若干默认的组件实现:基于mysql的分布式事务日志存储,基于ribbon-rest的RPC实现,基于KAFKA的消息队列,若不需要或者要替换,可以EXCLUDE掉 @@ -388,7 +386,17 @@ Starter里包含了若干默认的组件实现:基于mysql的分布式事务日 * 因此CRASH恢复进程使用select for update 查询executed_trans记录时,必然能得到准确的是否已经提交的结果(若主控事务仍在进行中,select for update将会等待) * 使用select for update是为了避免在MVCC情况下错误查询出最终事务提交结果的情况 -## 七、其他 +## 七、外部组件版本兼容性 +* ZK请使用3.4及以上版本 +* SpringBoot 2.0.x 以及 SpringCloud F版本的整合请参考Demo里的tccandfescar + * 需要注意的是写文档时最新版的spring boot(2.0.8)引入的最新版mysql-connector-java (5.1.47)存在bug,要降级为5.1.46 + * 另因SpringCloud大版本变更时导致某些包名变动,在F版本时使用ET的Ribbon时,需要在项目单独引入spring-cloud-starter-netflix-ribbon +* 如果遇到ZK库相关的包匹配问题,需要检查当前项目的相关包版本 + * 在1.2.0版本后,curator-recipes及curator-framework需为4.x.x,zookeeper客户端版本需为3.4.x或者3.5.x(视ZK服务器版本而定) + * 1.2.0版本前,curator-recipes及curator-framework需为2..x.x,zookeeper客户端版本同上 + + +## 八、其他 欢迎加作者个人微信公众号 ![wechat public account](https://raw.githubusercontent.com/QNJR-GROUP/ImageHub/master/easytrans/wechat_public_account.jpg) @@ -398,8 +406,8 @@ Starter里包含了若干默认的组件实现:基于mysql的分布式事务日 email: skyes.xu@qq.com 我写的关于ET的一些额外文章,请点赞以帮助SEO: -如何选择分布式事务形态 https://www.cnblogs.com/skyesx/p/9697817.html -“若干分布式事务框架”与“我的偏见” https://www.cnblogs.com/skyesx/p/10041923.html +* 如何选择分布式事务形态 https://www.cnblogs.com/skyesx/p/9697817.html +* “若干分布式事务框架”与“我的偏见” https://www.cnblogs.com/skyesx/p/10041923.html