Alonexc commented on code in PR #4343:
URL: https://github.com/apache/eventmesh/pull/4343#discussion_r1289426809
##########
eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/RemoteSubscribeInstance.java:
##########
@@ -31,25 +35,48 @@
import org.apache.eventmesh.common.protocol.http.common.ProtocolKey;
import org.apache.eventmesh.common.utils.IPUtils;
import org.apache.eventmesh.common.utils.JsonUtils;
+import org.apache.eventmesh.util.Utils;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
+import java.io.IOException;
import java.util.Collections;
import java.util.Objects;
+import java.util.Properties;
import io.netty.handler.codec.http.HttpMethod;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
public class RemoteSubscribeInstance {
static final CloseableHttpClient httpClient = HttpClients.createDefault();
+ Properties properties;
+
+ {
+ try {
+ properties =
Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME);
+ } catch (IOException e) {
+ log.error("Failed to read the file.", e);
+ }
+ }
+
+ final String localPort = properties.getProperty(SERVER_PORT);
+ final String httServerPort = properties.getProperty(EVENTMESH_HTTP_PORT);
+ final String testURL = getURL(localPort, "/sub/test");
+ final String localURL = getURL(httServerPort,
"/eventmesh/subscribe/local");
+ final String remoteURL = getURL(httServerPort,
"/eventmesh/subscribe/remote");
Review Comment:
<img width="280" alt="image"
src="https://github.com/apache/eventmesh/assets/91315508/0f9b1f2a-97be-46d0-914e-651b204a408e">
<img width="599" alt="image"
src="https://github.com/apache/eventmesh/assets/91315508/bd89b581-b725-4e44-86fb-87618ef70860">
All these ports already exist in the config file, I think it might be better
to get them directly from the config file?
--
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]