Alonexc commented on code in PR #4343:
URL: https://github.com/apache/eventmesh/pull/4343#discussion_r1289427616
##########
eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/RemoteSubscribeInstance.java:
##########
@@ -58,38 +85,37 @@ private static void subscribeRemote() {
final RequestParam subscribeParam = buildCommonRequestParam()
.addBody(SubscribeRequestBody.TOPIC,
JsonUtils.toJSONString(Collections.singletonList(subscriptionItem)))
.addBody(SubscribeRequestBody.CONSUMERGROUP,
ExampleConstants.DEFAULT_EVENTMESH_TEST_CONSUMER_GROUP)
- .addBody(SubscribeRequestBody.URL,
"http://127.0.0.1:8088/sub/test")
- .addBody("remoteMesh",
"http://127.0.0.1:10105/eventmesh/subscribe/local");
+ .addBody(SubscribeRequestBody.URL, testURL)
+ .addBody("remoteMesh", localURL);
postMsg(subscribeParam);
}
- private static void unsubscribeRemote() {
+ private void unsubscribeRemote() {
final RequestParam subscribeParam = buildCommonRequestParam()
.addBody(SubscribeRequestBody.TOPIC,
JsonUtils.toJSONString(Collections.singletonList(ExampleConstants.EVENTMESH_HTTP_ASYNC_TEST_TOPIC)))
.addBody(SubscribeRequestBody.CONSUMERGROUP,
ExampleConstants.DEFAULT_EVENTMESH_TEST_CONSUMER_GROUP)
- .addBody(SubscribeRequestBody.URL,
"http://127.0.0.1:8088/sub/test");
+ .addBody(SubscribeRequestBody.URL, testURL);
postMsg(subscribeParam);
}
- private static void postMsg(RequestParam subscribeParam) {
+ private void postMsg(RequestParam subscribeParam) {
// cluster2 ip
- final String target =
"http://127.0.0.1:11105/eventmesh/subscribe/remote";
try {
- final String res = HttpUtils.post(httpClient, target,
subscribeParam);
+ final String res = HttpUtils.post(httpClient, remoteURL,
subscribeParam);
final EventMeshRetObj ret = JsonUtils.parseObject(res,
EventMeshRetObj.class);
if (Objects.requireNonNull(ret).getRetCode() !=
EventMeshRetCode.SUCCESS.getRetCode()) {
throw new EventMeshException(ret.getRetCode(),
ret.getRetMsg());
}
} catch (Exception ex) {
- throw new EventMeshException(String.format("Subscribe topic error,
target:%s", target), ex);
+ throw new EventMeshException(String.format("Subscribe topic error,
target:%s", remoteURL), ex);
}
}
- private static RequestParam buildCommonRequestParam() {
+ private RequestParam buildCommonRequestParam() {
return new RequestParam(HttpMethod.POST)
- .addHeader(ProtocolKey.ClientInstanceKey.IP,
IPUtils.getLocalAddress())
+ .addHeader(ProtocolKey.ClientInstanceKey.IP.getKey(),
IPUtils.getLocalAddress())
Review Comment:
OK, I can i resolve the conflict on my end.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]