├── .gitignore
├── LICENSE
├── NewVersion.md
├── README-cn.md
├── README.md
├── dtmcli-common
├── pom.xml
└── src
│ └── main
│ └── java
│ └── pub
│ └── dtm
│ └── client
│ ├── constant
│ ├── Constants.java
│ └── ParamFieldConstants.java
│ ├── enums
│ └── TransTypeEnum.java
│ ├── exception
│ └── FailureException.java
│ ├── interfaces
│ ├── dtm
│ │ └── DtmConsumer.java
│ └── stub
│ │ ├── IDtmServerStub.java
│ │ └── IURIParser.java
│ ├── log
│ └── DtmFeignLogger.java
│ ├── model
│ ├── dtm
│ │ └── TransBase.java
│ ├── feign
│ │ └── ServiceMessage.java
│ ├── param
│ │ ├── OperatorParam.java
│ │ ├── SagaOperatorParam.java
│ │ └── TccOperatorParam.java
│ └── responses
│ │ └── DtmResponse.java
│ └── utils
│ ├── FeignUtils.java
│ ├── HttpUtils.java
│ └── JsonUtils.java
├── dtmcli-core
├── pom.xml
└── src
│ └── main
│ └── java
│ └── pub
│ └── dtm
│ └── client
│ ├── barrier
│ ├── BarrierParam.java
│ ├── BranchBarrier.java
│ └── itfc
│ │ ├── BarrierDBOperator.java
│ │ ├── ConnectionCallback.java
│ │ ├── ConnectionManager.java
│ │ └── impl
│ │ └── BarrierMysqlOperator.java
│ ├── base
│ └── BranchIdGenerator.java
│ ├── saga
│ └── Saga.java
│ └── tcc
│ └── Tcc.java
├── dtmcli-java
├── pom.xml
└── src
│ └── main
│ └── java
│ └── pub
│ └── dtm
│ └── client
│ ├── DtmClient.java
│ ├── properties
│ └── DtmProperties.java
│ ├── stub
│ ├── DtmFeignClient.java
│ └── URIParser.java
│ └── utils
│ └── NacosUtils.java
├── dtmcli-springcloud
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── pub
│ │ └── dtm
│ │ └── client
│ │ ├── DtmClient.java
│ │ ├── configuration
│ │ └── DtmConfiguration.java
│ │ ├── properties
│ │ └── DtmProperties.java
│ │ └── stub
│ │ ├── DtmFeignClient.java
│ │ └── URIParser.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── eureka-plugin
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── pub
│ │ └── dtm
│ │ └── client
│ │ └── configuration
│ │ └── EurekaConfiguration.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── nacos-plugin
└── pom.xml
├── pic_ref
├── newversion.png
└── oldversion.png
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 |
25 | .idea
26 | *.iml
27 | /*/target/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 dtm-labs
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NewVersion.md:
--------------------------------------------------------------------------------
1 | # new version
2 | 新版本相比于旧版本Java client的的改造
3 | ## 旧版本客户端
4 | 
5 | ### 旧版本在设计上可以改进的一些地方
6 | 1.引入的类从引入路径看不出来自哪个jar包,比如exception.FailureException。在大型项目中可能会出现多个相同的类名,如果不明确包名可能会导致意义混乱,甚至引入冲突。
7 | 2.tcc等类直接依赖了dtmsvr信息,这样的依赖方式对后期的维护不友好,如果修改了DtmServerInfo的属性,那么后期需要修改所有支持的方式。应该做一个客户端这样的东西专门用来发送请求。
8 | 3.向dtmsvr传递参数时使用了map来传递,虽然这对用户是无感知的,但是客户在debug的时候使用map比较麻烦,感觉使用一个param对象比较好
9 | ## 新版本客户端
10 | 
11 | ### 新版本中改进的地方
12 | 1.由于新版本需要同时支持http和feign两种交互方式,因此将请求dtmsvr相关的部分以及整个client的公共部分抽取出来形成了dtmcli-common模块,这样后续如果需要支持更多的交互方式只需要改动dtmcli-common中的代码,并在core新增代码
13 | 2.springcloud版本的client不在乎需要传入ipport这样的配置参数,一切通过feign+nacos/euraka集成起来处理。因此将java-client和spring-client分开处理了
14 | 3.对于一些非springcloud的项目我们也提供了java-client来处理,java-client支持像以前那样直接配置endpoint的方式,同时为了适配frontend服务,也支持通过配置nacos服务中心地址这样的方式来动态查找dtmsvr具体的地址。
15 | 4.优化了整个项目的包结构,让引入dtmcli-java的时候能够快速找到来自哪个包
16 |
17 |
18 |
--------------------------------------------------------------------------------
/README-cn.md:
--------------------------------------------------------------------------------
1 | # dtmcli-java [![MIT][license-badge]](https://github.com/dtm-labs/dtmcli/blob/main/LICENSE)
2 |
3 | 简体中文 | [English](./README.md)
4 |
5 | `dtmcli-java` 是分布式事务管理器 [dtm](https://github.com/dtm-labs/dtm) 的Java客户端sdk
6 |
7 | ## DTM是什么
8 |
9 | DTM是一款变革性的分布式事务框架,提供了傻瓜式的使用方式,极大的降低了分布式事务的使用门槛,改变了“能不用分布式事务就不用”的行业现状,优雅的解决了服务间的数据一致性问题。
10 |
11 | ## 特性
12 | * 支持多种语言:支持Go、Java、PHP、C#、Python、Nodejs 各种语言的SDK
13 | * 支持多种事务模式:SAGA、TCC、XA
14 | * 支持消息最终一致性:二阶段消息,比本地消息表更优雅的方案
15 | * 支持多种数据库事务:Mysql、Redis、MongoDB、Postgres、TDSQL等
16 | * 支持多种存储引擎:Mysql(常用)、Redis(高性能)、MongoDB(规划中)
17 | * 支持多种微服务架构:[go-zero](https://github.com/zeromicro/go-zero)、go-kratos/kratos、polarismesh/polaris
18 | * 支持高可用,易水平扩展
19 |
20 | ## 使用方式
21 |
22 | ### 步骤一:确定你需要使用的版本
23 | 1. 您的项目是springcloud项目
24 | - 您的项目中springboot版本>=2.4.0,请选择dtmcli-springcloud相应的版本直接接入即可
25 | - 您的项目中的springboot版本<2.4.0,请选择dtmcli-java接入,dtmcli-java也提供了微服务相关的接口,请设置nacos服务中心的相关配置即可使用
26 | 2. 您的项目是普通项目/没有接入微服务的spring(boot)项目
27 | - 请选择dtmcli-java,并设置相应的配置即可
28 |
29 | | artifact| version | 适用版本 |备注|
30 | |:-----:|:----:|:----:|:----:|
31 | |dtmcli-springcloud| 2.1.4.1| 2.4.0 <= springboot version < 2.5.13| springboot 版本>=2.5.0,需要设置spring.cloud.compatibility-verifier.enabled=false|
32 | |dtmcli-springcloud| 2.1.4.2| 2.6.0 <= springboot version < 2.6.latest| |
33 | |dtmcli-java| 2.1.4| others| |
34 |
35 | ### 步骤二:添加依赖项
36 |
37 | Maven:
38 |
39 | ```bash
40 |
41 | io.github.dtm-labs
42 | dtmcli-springcloud
43 | ${dtmcli.version}
44 |
45 | ```
46 |
47 | Gradle:
48 |
49 | ```bash
50 | dependencies {
51 | implementation 'io.github.dtm-labs:dtmcli-springcloud:${dtmcli.version}'
52 | }
53 | ```
54 |
55 | ### 步骤三:设置dtmcli-java配置
56 | 如果您引入了dtmcli-java,则需要新建一个`dtm-conf.properties`配置文件
57 | - 情形一:您引入了nacos等服务中心组件的配置文件
58 | ```
59 | serverAddr=127.0.0.1:8848
60 | username=nacos
61 | password=nacos
62 | namespace=c3dc917d-906a-429d-90a9-85012b41014e
63 | dtm.service.name=dtmService
64 | dtm.service.registryType=nacos
65 | ```
66 | - 情形二:您直连dtmsvr
67 | ```
68 | dtm.ipport=127.0.0.1:36789
69 | ```
70 | ## 示例
71 |
72 | ```bash
73 | @RequestMapping("testTcc")
74 | public String testTcc() {
75 | //创建dtm clinet
76 | DtmClient dtmClient = new DtmClient(ipPort);
77 | //创建tcc事务
78 | try {
79 | dtmClient.tccGlobalTransaction(dtmClient.genGid(), TccTestController::tccTrans);
80 | } catch (Exception e) {
81 | log.error("tccGlobalTransaction error", e);
82 | return "fail";
83 | }
84 | return "success";
85 | }
86 |
87 | /**
88 | * 定义tcc事务函数,内部需要通过callBranch注册事务子分支
89 | *
90 | * @param tcc
91 | * @return
92 | * @see TransController
93 | */
94 | public static void tccTrans(Tcc tcc) throws Exception {
95 | Response outResponse = tcc
96 | .callBranch("", svc + "/TransOutTry", svc + "/TransOutConfirm", svc + "/TransOutCancel");
97 | log.info("outResponse:{}", outResponse);
98 | Response inResponse = tcc.callBranch("", svc + "/TransInTry", svc + "/TransInConfirm", svc + "/TransInCancel");
99 | log.info("inResponse:{}", inResponse);
100 | }
101 | ```
102 |
103 |
104 | ### 完整示例
105 |
106 | #### dtmcli-java使用示例
107 | [dtmcli-java-sample](https://github.com/dtm-labs/dtmcli-java-sample)
108 | [dtmcli-java-sample-use-configuration](https://github.com/horseLk/dtmcli-java-sample-with-conf)
109 | #### dtmcli-springcloud使用示例
110 | [dtmcli-java-spring-sample](https://github.com/dtm-labs/dtmcli-java-spring-sample)
111 |
112 | [license-badge]: https://img.shields.io/github/license/dtm-labs/dtmcli-java
113 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # dtmcli-java [![MIT][license-badge]](https://github.com/dtm-labs/dtmcli/blob/main/LICENSE)
2 |
3 | English | [简体中文](./README-cn.md)
4 |
5 | `dtmcli-java` is the Java client SDK for distributed transaction manager [dtm](https://github.com/dtm-labs/dtm)
6 |
7 | ## What is DTM
8 |
9 | DTM is a distributed transaction framework which provides cross-service eventual data consistency. It provides saga, tcc, xa, 2-phase message, outbox patterns for a variety of application scenarios. It also supports multiple languages and multiple store engine to form up a transaction as following:
10 |
11 |
12 |
13 | ## Features
14 | * Support for multiple languages: Go, Java, PHP, C#, Python, Nodejs SDKs
15 | * Support for multiple transaction patterns: SAGA, TCC, XA
16 | * Support for OutBox pattern: 2-phase messages, a more elegant solution than OutBox
17 | * Support for multiple database transactions: Mysql, Redis, MongoDB, Postgres, TDSQL, etc.
18 | * Support for multiple storage engines: Mysql (common), Redis (high performance), MongoDB (in planning)
19 | * Support for multiple microservices architectures: [go-zero](https://github.com/zeromicro/go-zero), go-kratos/kratos, polarismesh/polaris
20 | * Support for high availability and easy horizontal scaling
21 |
22 | ## Usage
23 |
24 | ### Step 1: Determine the version
25 | 1. Springcloud Projects
26 | - If the version of springboot >= 2.4.0, choose a corresponding version of dtmcli-springcloud.
27 | - If the version of springboot <> 2.4.0, use dtmcli-java, it provide the interfaces for micro-services, please set the configuration for nacos.
28 | 2. Not Springcloud Projects.
29 | - use dtmcli-java,and set your configurations.
30 |
31 | | artifact| version | dtmcli-java version |remark|
32 | |:-----:|:----:|:----:|:----:|
33 | |dtmcli-springcloud| 2.1.4.1| 2.4.0 <= springboot version < 2.5.13| for springboot >= 2.5.0,please set spring.cloud.compatibility-verifier.enabled=false|
34 | |dtmcli-springcloud| 2.1.4.2| 2.6.0 <= springboot version < 2.6.latest| |
35 | |dtmcli-java| 2.1.4| others| |
36 |
37 | ### Step 2: Add Dependencies
38 |
39 | Maven:
40 |
41 | ```bash
42 |
43 | io.github.dtm-labs
44 | dtmcli-springcloud
45 | ${dtmcli.version}
46 |
47 | ```
48 |
49 | Gradle:
50 |
51 | ```bash
52 | dependencies {
53 | implementation 'io.github.dtm-labs:dtmcli-springcloud:${dtmcli.version}'
54 | }
55 | ```
56 |
57 | ### Step 3:Configure dtmcli-java
58 | If you are using dtmcli-java,new a file named `dtm-conf.properties`
59 | - Case 1: Using naceos
60 | ```
61 | serverAddr=127.0.0.1:8848
62 | username=nacos
63 | password=nacos
64 | namespace=c3dc917d-906a-429d-90a9-85012b41014e
65 | dtm.service.name=dtmService
66 | dtm.service.registryType=nacos
67 | ```
68 | - Case 2: Connect to dtmsvr directly
69 | ```
70 | dtm.ipport=127.0.0.1:36789
71 | ```
72 | ## Sample
73 |
74 | ```bash
75 | @RequestMapping("testTcc")
76 | public String testTcc() {
77 | // new dtm clinet
78 | DtmClient dtmClient = new DtmClient(ipPort);
79 | //create TCC transaction
80 | try {
81 | dtmClient.tccGlobalTransaction(dtmClient.genGid(), TccTestController::tccTrans);
82 | } catch (Exception e) {
83 | log.error("tccGlobalTransaction error", e);
84 | return "fail";
85 | }
86 | return "success";
87 | }
88 |
89 | /**
90 | * define TCC sub-transactions by calling callBranch
91 | *
92 | * @param tcc
93 | * @return
94 | * @see TransController
95 | */
96 | public static void tccTrans(Tcc tcc) throws Exception {
97 | Response outResponse = tcc
98 | .callBranch("", svc + "/TransOutTry", svc + "/TransOutConfirm", svc + "/TransOutCancel");
99 | log.info("outResponse:{}", outResponse);
100 | Response inResponse = tcc.callBranch("", svc + "/TransInTry", svc + "/TransInConfirm", svc + "/TransInCancel");
101 | log.info("inResponse:{}", inResponse);
102 | }
103 | ```
104 |
105 |
106 | ### Complete Sample
107 |
108 | #### Sample for dtmcli-java
109 | [dtmcli-java-sample](https://github.com/dtm-labs/dtmcli-java-sample)
110 | [dtmcli-java-sample-use-configuration](https://github.com/horseLk/dtmcli-java-sample-with-conf)
111 | #### Sample for dtmcli-springcloud
112 | [dtmcli-java-spring-sample](https://github.com/dtm-labs/dtmcli-java-spring-sample)
113 |
114 | [license-badge]: https://img.shields.io/github/license/dtm-labs/dtmcli-java
115 |
--------------------------------------------------------------------------------
/dtmcli-common/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | dtmcli-java-parent
7 | io.github.dtm-labs
8 | 2.1.8
9 |
10 | 4.0.0
11 |
12 | dtmcli-common
13 | 2.1.8
14 | jar
15 | dtmcli-common
16 |
17 |
18 | UTF-8
19 | 1.8
20 | 1.8
21 |
22 |
23 |
24 |
25 |
26 | com.fasterxml.jackson.core
27 | jackson-databind
28 |
29 |
30 |
31 | org.projectlombok
32 | lombok
33 |
34 |
35 |
36 | io.github.openfeign
37 | feign-core
38 |
39 |
40 |
41 | org.apache.commons
42 | commons-lang3
43 |
44 |
45 |
46 | com.squareup.okhttp3
47 | okhttp
48 |
49 |
50 |
51 | com.alibaba.nacos
52 | nacos-client
53 |
54 |
55 |
56 | org.slf4j
57 | slf4j-api
58 |
59 |
60 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/constant/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.constant;
26 |
27 | /**
28 | * Constants
29 | *
30 | * @author horseLk
31 | */
32 | public class Constants {
33 | public static final String MICRO_SERVICE_NAME_KEY = "dtm.service.name";
34 |
35 | public static final String GET_METHOD = "GET ";
36 |
37 | public static final String POST_METHOD = "POST ";
38 |
39 | public static final String HTTP_PREFIX = "http://";
40 |
41 | public static final String HTTPS_PREFIX = "https://";
42 |
43 | public static final String PING_URL = "/api/ping";
44 |
45 | private static final String BASE_URL = "/api/dtmsvr";
46 |
47 | public static final String NEW_GID_URL = BASE_URL + "/newGid";
48 |
49 | public static final String PREPARE_URL = BASE_URL + "/prepare";
50 |
51 | public static final String SUBMIT_URL = BASE_URL + "/submit";
52 |
53 | public static final String ABORT_URL = BASE_URL + "/abort";
54 |
55 | public static final String REGISTER_BRANCH_URL = BASE_URL + "/registerBranch";
56 |
57 | public static final String DEFAULT_STATUS = "prepared";
58 |
59 | public static final String EMPTY_STRING = "";
60 |
61 | public static final String SUCCESS_RESULT = "SUCCESS";
62 |
63 | public static final String FAILURE_RESULT = "FAILURE";
64 |
65 | public static final int RESP_ERR_CODE = 400;
66 | }
67 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/constant/ParamFieldConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.constant;
26 |
27 | /**
28 | * Constants for dtm server parameter key
29 | *
30 | * @author horseLk
31 | */
32 | public class ParamFieldConstants {
33 | public static final String GID = "gid";
34 |
35 | public static final String TRANS_TYPE = "trans_type";
36 |
37 | public static final String BRANCH_ID = "branch_id";
38 |
39 | public static final String STATUS = "status";
40 |
41 | public static final String DATA = "data";
42 |
43 | public static final String TRY = "try";
44 |
45 | public static final String CONFIRM = "confirm";
46 |
47 | public static final String CANCEL = "cancel";
48 |
49 | public static final String OP = "op";
50 |
51 | public static final String CODE = "code";
52 |
53 | public static final String MESSAGE = "message";
54 |
55 | public static final String DTM_RESULT = "dtm_result";
56 |
57 | public static final String ACTION = "action";
58 |
59 | public static final String COMPENSATE = "compensate";
60 |
61 | public static final String STEPS = "steps";
62 |
63 | public static final String PAYLOADS = "payloads";
64 |
65 | public static final String CUSTOM_DATA = "custom_data";
66 |
67 | public static final String WAIT_RESULT = "wait_result";
68 |
69 | public static final String TIMEOUT_TO_FAIL = "timeout_to_fail";
70 |
71 | public static final String RETRY_INTERVAL = "retry_interval";
72 |
73 | public static final String PASSTHROGH_HEADERS = "passthrough_headers";
74 |
75 | public static final String BRANCH_HEADERS = "branch_headers";
76 | }
77 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/enums/TransTypeEnum.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.enums;
26 |
27 | import java.util.HashMap;
28 | import java.util.Map;
29 |
30 | /**
31 | * Transtype enum
32 | *
33 | * @author horseLk
34 | */
35 | public enum TransTypeEnum {
36 | /**
37 | * tcc
38 | */
39 | TCC("tcc"),
40 | /**
41 | * xa
42 | */
43 | XA("xa"),
44 | /**
45 | * msg
46 | */
47 | MSG("msg"),
48 | /**
49 | * saga
50 | */
51 | SAGA("saga")
52 | ;
53 |
54 | TransTypeEnum(String value) {
55 | this.value = value;
56 | }
57 |
58 | /**
59 | * Trans type string
60 | */
61 | private final String value;
62 |
63 | public String getValue() {
64 | return this.value;
65 | }
66 |
67 | private static final Map EXIST = new HashMap<>();
68 |
69 | static {
70 | for (TransTypeEnum transType : TransTypeEnum.values()) {
71 | EXIST.put(transType.value, transType);
72 | }
73 | }
74 |
75 | public static TransTypeEnum parseString(String value) {
76 | return EXIST.get(value);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/exception/FailureException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.exception;
26 |
27 | /**
28 | * dtm common exception
29 | *
30 | * @author horseLk
31 | */
32 | public class FailureException extends Exception {
33 | public FailureException(String msg) {
34 | super(msg);
35 | }
36 |
37 | public FailureException(Throwable e) {
38 | super(e);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/interfaces/dtm/DtmConsumer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.interfaces.dtm;
26 |
27 | import pub.dtm.client.model.dtm.TransBase;
28 |
29 | /**
30 | * Functional Interface for Transtype to process busi request
31 | *
32 | * @param
33 | * @author horseLk
34 | */
35 | @FunctionalInterface
36 | public interface DtmConsumer {
37 | void accept(T t) throws Exception;
38 | }
39 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/interfaces/stub/IDtmServerStub.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.interfaces.stub;
26 |
27 | import feign.Response;
28 | import pub.dtm.client.model.param.OperatorParam;
29 | import pub.dtm.client.model.responses.DtmResponse;
30 |
31 | import java.net.URI;
32 | import java.util.Map;
33 |
34 | /**
35 | * A stub interface for dtm svr, different client has different implements.
36 | *
37 | * @author horseLk
38 | */
39 | public interface IDtmServerStub {
40 | /**
41 | * get stubType
42 | * @return type
43 | */
44 | String stubType();
45 |
46 | /**
47 | * get a new gid
48 | */
49 | DtmResponse newGid();
50 |
51 | /**
52 | * test connection
53 | */
54 | DtmResponse ping();
55 |
56 | /**
57 | * prepare
58 | * @param body prepare body
59 | */
60 | DtmResponse prepare(OperatorParam body);
61 |
62 | /**
63 | * submit
64 | * @param body submit bosy
65 | */
66 | DtmResponse submit(OperatorParam body);
67 |
68 | /**
69 | * abort
70 | * @param body abort body
71 | */
72 | DtmResponse abort(OperatorParam body);
73 |
74 | /**
75 | * registerBranch
76 | * @param body registerBranch body
77 | */
78 | DtmResponse registerBranch(OperatorParam body);
79 |
80 | /**
81 | * use feign send busi get request
82 | * @param host busi host
83 | * @param path busi path
84 | * @param queryMap querymao
85 | */
86 | Response busiGet(URI host, String path, Map queryMap);
87 |
88 | /**
89 | * use feign send busi post request
90 | * @param host busi host
91 | * @param path busi path
92 | * @param queryMap query map
93 | * @param body request body
94 | */
95 | Response busiPost(URI host, String path, Map queryMap, Object body);
96 | }
97 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/interfaces/stub/IURIParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.interfaces.stub;
26 |
27 | import pub.dtm.client.model.feign.ServiceMessage;
28 |
29 | /**
30 | * URI Parser interface
31 | *
32 | * @author horseLk
33 | */
34 | public interface IURIParser {
35 | /**
36 | * according to serviceMessage and connection driver generate uri
37 | * @param serviceMessage service message
38 | * @param httpType true means http, false means microservice
39 | * @return uri
40 | * @throws Exception exception
41 | */
42 | String generatorURI(ServiceMessage serviceMessage, boolean httpType) throws Exception;
43 | }
44 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/log/DtmFeignLogger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.log;
26 |
27 | import org.slf4j.Logger;
28 | import org.slf4j.LoggerFactory;
29 |
30 | /**
31 | * Custom feign logger for print detail feign log
32 | *
33 | * @author horseLk
34 | */
35 | public class DtmFeignLogger extends feign.Logger {
36 | private final Logger logger;
37 |
38 | public DtmFeignLogger() {
39 | this(feign.Logger.class);
40 | }
41 |
42 | public DtmFeignLogger(Class> clazz) {
43 | this(LoggerFactory.getLogger(clazz));
44 | }
45 |
46 | public DtmFeignLogger(String name) {
47 | this(LoggerFactory.getLogger(name));
48 | }
49 |
50 | DtmFeignLogger(Logger logger) {
51 | this.logger = logger;
52 | }
53 |
54 | @Override
55 | protected void log(String configKey, String format, Object... args) {
56 | // Not using SLF4J's support for parameterized messages (even though it
57 | // would be more efficient) because it would
58 | // require the incoming message formats to be SLF4J-specific.
59 | if (logger.isInfoEnabled()) {
60 | logger.info(String.format(methodTag(configKey) + format, args));
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/model/dtm/TransBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.model.dtm;
26 |
27 | import pub.dtm.client.enums.TransTypeEnum;
28 | import lombok.AllArgsConstructor;
29 | import lombok.Data;
30 | import lombok.NoArgsConstructor;
31 |
32 | /**
33 | * base Class for different Trans type
34 | *
35 | * @author horseLk
36 | */
37 | @Data
38 | @NoArgsConstructor
39 | @AllArgsConstructor
40 | public class TransBase {
41 | /**
42 | * global transaction id
43 | */
44 | private String gid;
45 |
46 | /**
47 | * trans type
48 | */
49 | private TransTypeEnum transTypeEnum;
50 |
51 | /**
52 | * is wait for result
53 | */
54 | private boolean waitResult;
55 | }
56 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/model/feign/ServiceMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.model.feign;
26 |
27 | import lombok.Data;
28 | import lombok.NoArgsConstructor;
29 | import org.apache.commons.lang3.StringUtils;
30 |
31 | import java.util.ArrayList;
32 | import java.util.List;
33 |
34 | /**
35 | * Service message for micro service
36 | *
37 | * @author horseLk
38 | */
39 | @Data
40 | @NoArgsConstructor
41 | public class ServiceMessage {
42 | /**
43 | * service name
44 | */
45 | private String serviceName;
46 |
47 | /**
48 | * group name
49 | */
50 | private String groupName = "DEFAULT_GROUP";
51 |
52 | /**
53 | * clusters
54 | */
55 | private List cluster = new ArrayList<>();
56 |
57 | /**
58 | * request path
59 | */
60 | private String path;
61 |
62 | public ServiceMessage(String serviceName, String path){
63 | this.serviceName = serviceName;
64 | this.path = path;
65 | }
66 |
67 | public ServiceMessage(String serviceName, String groupName, List cluster, String path) {
68 | this.serviceName = serviceName;
69 | this.groupName = groupName;
70 | this.cluster.addAll(cluster);
71 | this.path = path;
72 | }
73 |
74 | public String getPath() {
75 | if (StringUtils.startsWith(path, "/")) {
76 | return path;
77 | }
78 | return "/" + path;
79 | }
80 |
81 | @Override
82 | public String toString() {
83 | String _path = path;
84 | if (!StringUtils.startsWith(path, "/")) {
85 | _path = "/" + path;
86 | }
87 | return serviceName + _path + "?groupName=" + groupName;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/model/param/OperatorParam.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.model.param;
26 |
27 | import com.fasterxml.jackson.annotation.JsonProperty;
28 | import com.fasterxml.jackson.annotation.JsonSubTypes;
29 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
30 | import pub.dtm.client.constant.ParamFieldConstants;
31 | import pub.dtm.client.enums.TransTypeEnum;
32 | import lombok.AllArgsConstructor;
33 | import lombok.Data;
34 | import lombok.NoArgsConstructor;
35 |
36 | /**
37 | * Request Param for dtm svr
38 | *
39 | * @author horseLk
40 | */
41 | @Data
42 | @NoArgsConstructor
43 | @AllArgsConstructor
44 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "subType")
45 | @JsonSubTypes({
46 | @JsonSubTypes.Type(value = TccOperatorParam.class, name = "tcc"),
47 | @JsonSubTypes.Type(value = SagaOperatorParam.class, name = "saga")
48 | })
49 | public class OperatorParam {
50 | /**
51 | * gid
52 | */
53 | @JsonProperty(ParamFieldConstants.GID)
54 | private String gid;
55 |
56 | /**
57 | * trans type string value
58 | */
59 | @JsonProperty(ParamFieldConstants.TRANS_TYPE)
60 | private String transType;
61 |
62 | /**
63 | * this attribute just for mark different sub class for encode/decode.
64 | */
65 | @JsonProperty("subType")
66 | private String subType;
67 |
68 | public OperatorParam(String gid, TransTypeEnum transType) {
69 | this.gid = gid;
70 | this.transType = transType.getValue();
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/dtmcli-common/src/main/java/pub/dtm/client/model/param/SagaOperatorParam.java:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2022 dtm-labs
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package pub.dtm.client.model.param;
26 |
27 | import com.fasterxml.jackson.annotation.JsonProperty;
28 | import lombok.Data;
29 | import lombok.NoArgsConstructor;
30 | import pub.dtm.client.constant.ParamFieldConstants;
31 | import pub.dtm.client.enums.TransTypeEnum;
32 |
33 | import java.util.List;
34 | import java.util.Map;
35 |
36 | /**
37 | * Saga Operator Param
38 | *
39 | * @author horseLk
40 | */
41 | @Data
42 | @NoArgsConstructor
43 | public class SagaOperatorParam extends OperatorParam {
44 | @JsonProperty(ParamFieldConstants.STEPS)
45 | private List