Skip to content

Commit a6e2670

Browse files
authored
Merge pull request #42 from horseLk/main
fix saga bug&support checkresult reutrn result
2 parents 7df2be9 + fb5b2ab commit a6e2670

File tree

10 files changed

+37
-15
lines changed

10 files changed

+37
-15
lines changed

dtmcli-common/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<artifactId>dtmcli-java-parent</artifactId>
77
<groupId>io.github.dtm-labs</groupId>
8-
<version>2.1.6</version>
8+
<version>2.1.8</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>dtmcli-common</artifactId>
13-
<version>2.1.6</version>
13+
<version>2.1.8</version>
1414
<packaging>jar</packaging>
1515
<name>dtmcli-common</name>
1616

dtmcli-common/src/main/java/pub/dtm/client/utils/FeignUtils.java

+11
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ public static String generatorURI(ServiceMessage serviceMessage, boolean httpTyp
8989
* @throws FailureException exception
9090
*/
9191
public static void checkResult(Response response) throws FailureException {
92+
checkResultWithReturn(response);
93+
}
94+
95+
/**
96+
* check response and return result
97+
* @param response
98+
* @return
99+
* @throws FailureException
100+
*/
101+
public static String checkResultWithReturn(Response response) throws FailureException {
92102
if (response.status() >= Constants.RESP_ERR_CODE){
93103
if (response.reason() != null) {
94104
throw new FailureException(response.reason());
@@ -115,5 +125,6 @@ public static void checkResult(Response response) throws FailureException {
115125
if (result.contains(Constants.FAILURE_RESULT)){
116126
throw new FailureException("Service returned failed");
117127
}
128+
return result;
118129
}
119130
}

dtmcli-common/src/main/java/pub/dtm/client/utils/HttpUtils.java

+11
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ public static String splicingUrl(String ip, int port, String path) {
108108
* @throws Exception exception
109109
*/
110110
public static void checkResult(Response response) throws Exception {
111+
checkResultWithReturn(response);
112+
}
113+
114+
/**
115+
* check response and return result
116+
* @param response
117+
* @return
118+
* @throws Exception
119+
*/
120+
public static String checkResultWithReturn(Response response) throws Exception {
111121
if (response.code() >= Constants.RESP_ERR_CODE){
112122
throw new FailureException(response.message());
113123
}
@@ -119,5 +129,6 @@ public static void checkResult(Response response) throws Exception {
119129
if (result.contains(Constants.FAILURE_RESULT)){
120130
throw new FailureException("Service returned failed");
121131
}
132+
return result;
122133
}
123134
}

dtmcli-core/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<artifactId>dtmcli-java-parent</artifactId>
77
<groupId>io.github.dtm-labs</groupId>
8-
<version>2.1.6</version>
8+
<version>2.1.8</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>dtmcli-core</artifactId>
13-
<version>2.1.6</version>
13+
<version>2.1.8</version>
1414
<packaging>jar</packaging>
1515
<name>dtmcli-core</name>
1616

dtmcli-core/src/main/java/pub/dtm/client/saga/Saga.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public Saga setRetryInterval(long retryInterval) {
155155
return this;
156156
}
157157

158-
public Saga setBranchHeaders(Map<String, String> headers) {
158+
public Saga setBranchHeaders(Map<String, String> branchHeaders) {
159159
this.branchHeaders = branchHeaders;
160160
return this;
161161
}
@@ -171,7 +171,7 @@ private void addConcurrentContext() {
171171
data.put(ORDERS, orders);
172172
data.put(CONCURRENT, true);
173173
try {
174-
this.setCustomData(JsonUtils.toJson(data));
174+
this.customData = JsonUtils.toJson(data);
175175
} catch (Exception e) {
176176
log.error("encode json error.");
177177
}

dtmcli-java/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>dtmcli-java</artifactId>
13-
<version>2.1.6</version>
13+
<version>2.1.8</version>
1414
<packaging>jar</packaging>
1515
<name>dtmcli-java</name>
1616

@@ -24,13 +24,13 @@
2424
<dependency>
2525
<groupId>io.github.dtm-labs</groupId>
2626
<artifactId>dtmcli-common</artifactId>
27-
<version>2.1.6</version>
27+
<version>2.1.8</version>
2828
</dependency>
2929

3030
<dependency>
3131
<groupId>io.github.dtm-labs</groupId>
3232
<artifactId>dtmcli-core</artifactId>
33-
<version>2.1.6</version>
33+
<version>2.1.8</version>
3434
</dependency>
3535

3636
<dependency>

dtmcli-springcloud/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>dtmcli-springcloud</artifactId>
13-
<version>2.1.6.2</version>
13+
<version>2.1.8.2</version>
1414
<packaging>jar</packaging>
1515
<name>dtmcli-springcloud</name>
1616

@@ -28,13 +28,13 @@
2828
<dependency>
2929
<groupId>io.github.dtm-labs</groupId>
3030
<artifactId>dtmcli-common</artifactId>
31-
<version>2.1.6</version>
31+
<version>2.1.8</version>
3232
</dependency>
3333

3434
<dependency>
3535
<groupId>io.github.dtm-labs</groupId>
3636
<artifactId>dtmcli-core</artifactId>
37-
<version>2.1.6</version>
37+
<version>2.1.8</version>
3838
</dependency>
3939

4040
<dependency>

eureka-plugin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>eureka-plugin</artifactId>
13-
<version>2.1.6.1</version>
13+
<version>2.1.8.2</version>
1414
<packaging>jar</packaging>
1515
<name>eureka-plugin</name>
1616

nacos-plugin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>nacos-plugin</artifactId>
13-
<version>2.1.6.1</version>
13+
<version>2.1.8.2</version>
1414
<packaging>jar</packaging>
1515
<name>nacos-plugin</name>
1616

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.dtm-labs</groupId>
88
<artifactId>dtmcli-java-parent</artifactId>
9-
<version>2.1.6</version>
9+
<version>2.1.8</version>
1010
<packaging>pom</packaging>
1111

1212
<name>dtmcli-java-parent</name>

0 commit comments

Comments
 (0)