This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new cba698d2f [ISSUE 4120] Fix the file read as null. (#4121)
cba698d2f is described below
commit cba698d2f85c219bd74b6d583d4d186f8e5a5bce
Author: Alonexc <[email protected]>
AuthorDate: Wed Jun 14 10:24:00 2023 +0800
[ISSUE 4120] Fix the file read as null. (#4121)
* Create .lift.toml
* Update .lift.toml
* Update .lift.toml
* Update .lift.toml
* Update .lift.toml
* Update .lift.toml
* Update .lift.toml
* Update .lift.toml
* Update .lift.toml
* delete lift
* fix 4120
* fix 4120
* change to using try-catch
---
.../apache/eventmesh/grpc/sub/app/service/SubService.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git
a/eventmesh-examples/src/main/java/org/apache/eventmesh/grpc/sub/app/service/SubService.java
b/eventmesh-examples/src/main/java/org/apache/eventmesh/grpc/sub/app/service/SubService.java
index 90d158397..99d840fa2 100644
---
a/eventmesh-examples/src/main/java/org/apache/eventmesh/grpc/sub/app/service/SubService.java
+++
b/eventmesh-examples/src/main/java/org/apache/eventmesh/grpc/sub/app/service/SubService.java
@@ -32,6 +32,7 @@ import org.apache.eventmesh.common.utils.IPUtils;
import org.apache.eventmesh.grpc.pub.eventmeshmessage.AsyncPublishInstance;
import org.apache.eventmesh.util.Utils;
+import java.io.IOException;
import java.util.Collections;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
@@ -53,6 +54,14 @@ public class SubService implements InitializingBean {
private final SubscriptionItem subscriptionItem = new SubscriptionItem();
+ {
+ try {
+ properties =
Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME);
+ } catch (IOException e) {
+ log.error("Failed to read the file.", e);
+ }
+ }
+
private final String localIp = IPUtils.getLocalAddress();
private final String localPort = properties.getProperty(SERVER_PORT);
private final String eventMeshIp =
properties.getProperty(ExampleConstants.EVENTMESH_IP);
@@ -82,8 +91,6 @@ public class SubService implements InitializingBean {
eventMeshGrpcConsumer.subscribe(Collections.singletonList(subscriptionItem),
url);
- properties =
Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME);
-
// Wait for all messaged to be consumed
final Thread stopThread = new Thread(() -> {
try {
@@ -92,13 +99,13 @@ public class SubService implements InitializingBean {
if (log.isWarnEnabled()) {
log.warn("exception occurred when countDownLatch.await ",
e);
}
+ Thread.currentThread().interrupt();
}
if (log.isInfoEnabled()) {
log.info("stopThread start....");
}
- //throw new RuntimeException();
});
stopThread.start();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]