pandaapo commented on code in PR #4640:
URL: https://github.com/apache/eventmesh/pull/4640#discussion_r1426026520


##########
eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/connector/FileSourceConnector.java:
##########
@@ -73,12 +96,48 @@ public String name() {
 
     @Override
     public void stop() {
-
+        try {
+            inputStream.close();
+        } catch (Exception e) {
+            log.error("Error closing resources: {}", e.getMessage());
+        }
     }
 
     @Override
     public List<ConnectRecord> poll() {
-        return null;
+        List<ConnectRecord> connectRecords = new ArrayList<>();
+        try {
+            BufferedReader bufferedReader = new BufferedReader(new 
InputStreamReader(inputStream, StandardCharsets.UTF_8));

Review Comment:
   Can BufferedReader object be set as a global variable? Additionally, in your 
current code, BufferedReader has a memory leak problem.



##########
eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/connector/FileSourceConnector.java:
##########
@@ -45,7 +63,8 @@ public Class<? extends Config> configClass() {
     public void init(Config config) throws Exception {
         // init config for hdfs source connector
         this.sourceConfig = (FileSourceConfig) config;
-
+        this.filePath = buildFilePath();
+        this.fileName = buildFileName();

Review Comment:
   Could the file name and file path be directly configured in the 
configuration file? Additionally, could unnecessary configurations in the 
configuration file be removed?



-- 
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]

Reply via email to