Skip to content

Commit 982bf7d

Browse files
committed
release: release 1.0.4.RELEASE version
1 parent 99b8348 commit 982bf7d

File tree

7 files changed

+91
-43
lines changed

7 files changed

+91
-43
lines changed

capa-spi-aws-config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<artifactId>capa-aws-parent</artifactId>
2525
<groupId>group.rxcloud</groupId>
26-
<version>1.0.4-alpha-2</version>
26+
<version>1.0.4.RELEASE</version>
2727
</parent>
2828

2929
<artifactId>capa-spi-aws-config</artifactId>

capa-spi-aws-infrastructure/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<artifactId>capa-aws-parent</artifactId>
2525
<groupId>group.rxcloud</groupId>
26-
<version>1.0.4-alpha-2</version>
26+
<version>1.0.4.RELEASE</version>
2727
</parent>
2828

2929
<artifactId>capa-spi-aws-infrastructure</artifactId>

capa-spi-aws-mesh/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<artifactId>capa-aws-parent</artifactId>
2525
<groupId>group.rxcloud</groupId>
26-
<version>1.0.4-alpha-2</version>
26+
<version>1.0.4.RELEASE</version>
2727
</parent>
2828

2929
<artifactId>capa-spi-aws-mesh</artifactId>

capa-spi-aws-mesh/src/main/java/group/rxcloud/capa/spi/aws/mesh/http/AwsCapaHttp.java

Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import group.rxcloud.capa.spi.aws.mesh.http.serializer.AwsCapaSerializerProvider;
2626
import group.rxcloud.capa.spi.http.CapaSerializeHttpSpi;
2727
import group.rxcloud.capa.spi.http.config.RpcServiceOptions;
28+
import group.rxcloud.cloudruntimes.domain.core.invocation.HttpExtension;
2829
import group.rxcloud.cloudruntimes.utils.TypeRef;
2930
import okhttp3.Headers;
3031
import okhttp3.OkHttpClient;
@@ -34,6 +35,7 @@
3435
import org.slf4j.LoggerFactory;
3536
import software.amazon.awssdk.utils.StringUtils;
3637

38+
import java.util.List;
3739
import java.util.Map;
3840
import java.util.Objects;
3941
import java.util.concurrent.CompletableFuture;
@@ -54,15 +56,25 @@ public AwsCapaHttp(OkHttpClient httpClient, CapaObjectSerializer objectSerialize
5456
}
5557

5658
@Override
57-
protected <T> CompletableFuture<HttpResponse<T>> invokeSpiApi(String appId,
58-
String method,
59-
Object requestData,
60-
Map<String, String> headers,
61-
TypeRef<T> type,
62-
RpcServiceOptions rpcServiceOptions) {
59+
protected <T> CompletableFuture<HttpResponse<T>> invokeSpiApi(
60+
String appId,
61+
String method,
62+
Object requestData,
63+
String httpMethod,
64+
Map<String, String> headers,
65+
Map<String, List<String>> urlParameters,
66+
TypeRef<T> type,
67+
RpcServiceOptions rpcServiceOptions) {
6368
Objects.requireNonNull(rpcServiceOptions, "rpcServiceOptions");
6469
AwsToAwsHttpServiceMeshInvoker awsToAwsHttpServiceMeshInvoker = new AwsToAwsHttpServiceMeshInvoker();
65-
return awsToAwsHttpServiceMeshInvoker.doInvokeSpiApi(appId, method, requestData, headers, type, (AwsRpcServiceOptions) rpcServiceOptions);
70+
return awsToAwsHttpServiceMeshInvoker.doInvokeSpiApi(
71+
appId,
72+
method,
73+
requestData,
74+
httpMethod,
75+
headers, urlParameters,
76+
type,
77+
(AwsRpcServiceOptions) rpcServiceOptions);
6678
}
6779

6880
private interface AwsHttpInvoker {
@@ -79,12 +91,15 @@ private interface AwsHttpInvoker {
7991
* @param rpcServiceOptions the rpc service options
8092
* @return the async completable future
8193
*/
82-
<T> CompletableFuture<HttpResponse<T>> doInvokeSpiApi(String appId,
83-
String method,
84-
Object requestData,
85-
Map<String, String> headers,
86-
TypeRef<T> type,
87-
AwsRpcServiceOptions rpcServiceOptions);
94+
<T> CompletableFuture<HttpResponse<T>> doInvokeSpiApi(
95+
String appId,
96+
String method,
97+
Object requestData,
98+
String httpMethod,
99+
Map<String, String> headers,
100+
Map<String, List<String>> urlParameters,
101+
TypeRef<T> type,
102+
AwsRpcServiceOptions rpcServiceOptions);
88103
}
89104

90105
/**
@@ -98,12 +113,15 @@ private class AwsToAwsHttpServiceMeshInvoker implements AwsHttpInvoker {
98113
private static final String POST = "POST";
99114

100115
@Override
101-
public <T> CompletableFuture<HttpResponse<T>> doInvokeSpiApi(String appId,
102-
String method,
103-
Object requestData,
104-
Map<String, String> headers,
105-
TypeRef<T> type,
106-
AwsRpcServiceOptions rpcServiceOptions) {
116+
public <T> CompletableFuture<HttpResponse<T>> doInvokeSpiApi(
117+
String appId,
118+
String method,
119+
Object requestData,
120+
String httpMethod,
121+
Map<String, String> headers,
122+
Map<String, List<String>> urlParameters,
123+
TypeRef<T> type,
124+
AwsRpcServiceOptions rpcServiceOptions) {
107125
AwsRpcServiceOptions.AwsToAwsServiceOptions awsToAwsServiceOptions = rpcServiceOptions.getAwsToAwsServiceOptions();
108126
final String serviceId = awsToAwsServiceOptions.getServiceId();
109127
if (StringUtils.isBlank(serviceId)) {
@@ -114,25 +132,50 @@ public <T> CompletableFuture<HttpResponse<T>> doInvokeSpiApi(String appId,
114132
final int servicePort = awsToAwsServiceOptions.getServicePort();
115133
final String namespace = awsToAwsServiceOptions.getNamespace();
116134

117-
return doAsyncInvoke(method, requestData, headers, type, serviceId, namespace, servicePort);
135+
if (httpMethod == null) {
136+
httpMethod = POST;
137+
}
138+
139+
return doAsyncInvoke(
140+
method,
141+
requestData,
142+
httpMethod,
143+
headers,
144+
urlParameters,
145+
type,
146+
serviceId,
147+
namespace,
148+
servicePort);
118149
}
119150

120-
private <T> CompletableFuture<HttpResponse<T>> doAsyncInvoke(String method,
121-
Object requestData,
122-
Map<String, String> headers,
123-
TypeRef<T> type,
124-
String serviceId,
125-
String namespace,
126-
int servicePort) {
151+
private <T> CompletableFuture<HttpResponse<T>> doAsyncInvoke(
152+
String method,
153+
Object requestData,
154+
String httpMethod,
155+
Map<String, String> headers,
156+
Map<String, List<String>> urlParameters,
157+
TypeRef<T> type,
158+
String serviceId,
159+
String namespace,
160+
int servicePort) {
127161
// generate app mesh http url
128162
final String appMeshHttpUrl = AwsCapaRpcProperties.AppMeshProperties.Settings.getRpcAwsAppMeshTemplate()
129163
.replace("{serviceId}", serviceId)
130164
.replace("{namespace}", namespace)
131165
.replace("{servicePort}", String.valueOf(servicePort))
132166
.replace("{operation}", method);
133167

168+
if (HttpExtension.GET.getMethod().toString().equals(httpMethod)) {
169+
// TODO: 2021/11/30 append urlParameters to url
170+
}
171+
134172
// async invoke
135-
CompletableFuture<HttpResponse<T>> asyncInvoke0 = post(appMeshHttpUrl, requestData, headers, type);
173+
CompletableFuture<HttpResponse<T>> asyncInvoke0 = invokeHttp(
174+
appMeshHttpUrl,
175+
requestData,
176+
httpMethod,
177+
headers,
178+
type);
136179
asyncInvoke0.exceptionally(throwable -> {
137180
if (logger.isWarnEnabled()) {
138181
logger.warn("[AwsCapaHttp] async invoke error", throwable);
@@ -142,10 +185,12 @@ private <T> CompletableFuture<HttpResponse<T>> doAsyncInvoke(String method,
142185
return asyncInvoke0;
143186
}
144187

145-
private <T> CompletableFuture<HttpResponse<T>> post(String url,
146-
Object requestData,
147-
Map<String, String> headers,
148-
TypeRef<T> type) {
188+
private <T> CompletableFuture<HttpResponse<T>> invokeHttp(
189+
String url,
190+
Object requestData,
191+
String httpMethod,
192+
Map<String, String> headers,
193+
TypeRef<T> type) {
149194
// generate http request body
150195
RequestBody body = getRequestBodyWithSerialize(requestData, headers);
151196
Headers header = getRequestHeaderWithParams(headers);
@@ -154,7 +199,7 @@ private <T> CompletableFuture<HttpResponse<T>> post(String url,
154199
Request request = new Request.Builder()
155200
.url(url)
156201
.headers(header)
157-
.method(POST, body)
202+
.method(httpMethod, body)
158203
.build();
159204

160205
return doAsyncInvoke0(request, type);

capa-spi-aws-mesh/src/main/java/group/rxcloud/capa/spi/aws/mesh/package-info.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
1817
package group.rxcloud.capa.spi.aws.mesh;

capa-spi-aws-mesh/src/test/java/group/rxcloud/capa/spi/aws/mesh/http/AwsCapaHttpTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public void testInvokeSpiApi_Success() {
5555
CompletableFuture<HttpResponse<String>> responseCompletableFuture = awsCapaHttp.invokeSpiApi("appId",
5656
"method",
5757
"requestData",
58+
"POST",
59+
new HashMap<>(),
5860
new HashMap<>(),
5961
TypeRef.STRING,
6062
awsRpcServiceOptions);
@@ -71,6 +73,8 @@ public void testInvokeSpiApi_FailWhenServiceIdIsNull() {
7173
awsCapaHttp.invokeSpiApi("appId",
7274
"method",
7375
"requestData",
76+
"POST",
77+
new HashMap<>(),
7478
new HashMap<>(),
7579
TypeRef.STRING,
7680
awsRpcServiceOptions);

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<groupId>group.rxcloud</groupId>
2424
<artifactId>capa-aws-parent</artifactId>
2525
<packaging>pom</packaging>
26-
<version>1.0.4-alpha-2</version>
26+
<version>1.0.4.RELEASE</version>
2727
<name>capa-aws-parent</name>
2828
<description>AWS for Capa.</description>
2929
<url>https://github.com/reactivegroup</url>
@@ -73,7 +73,7 @@
7373
<java.version>8</java.version>
7474
<file.encoding>UTF-8</file.encoding>
7575
<maven.version>3.8.1</maven.version>
76-
<capa.version>1.0.7-beta-3</capa.version>
76+
<capa.version>1.0.7.RELEASE</capa.version>
7777
<aws-sdk.version>2.17.40</aws-sdk.version>
7878
<junit.version>5.3.1</junit.version>
7979
<mockito-core.version>3.6.0</mockito-core.version>
@@ -101,22 +101,22 @@
101101
<dependency>
102102
<groupId>group.rxcloud</groupId>
103103
<artifactId>capa-spi-aws</artifactId>
104-
<version>1.0.4-alpha-2</version>
104+
<version>1.0.4.RELEASE</version>
105105
</dependency>
106106
<dependency>
107107
<groupId>group.rxcloud</groupId>
108108
<artifactId>capa-spi-aws-infrastructure</artifactId>
109-
<version>1.0.4-alpha-2</version>
109+
<version>1.0.4.RELEASE</version>
110110
</dependency>
111111
<dependency>
112112
<groupId>group.rxcloud</groupId>
113113
<artifactId>capa-spi-aws-mesh</artifactId>
114-
<version>1.0.4-alpha-2</version>
114+
<version>1.0.4.RELEASE</version>
115115
</dependency>
116116
<dependency>
117117
<groupId>group.rxcloud</groupId>
118118
<artifactId>capa-spi-aws-config</artifactId>
119-
<version>1.0.4-alpha-2</version>
119+
<version>1.0.4.RELEASE</version>
120120
</dependency>
121121

122122
<dependency>

0 commit comments

Comments
 (0)