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


##########
eventmesh-connectors/eventmesh-connector-file/src/main/resources/source-config.yml:
##########
@@ -28,13 +27,7 @@ connectorConfig:
     connectorName: fileSource
     nameserver: 127.0.0.1:9877
     topic: TopicTest

Review Comment:
   `nameserver` and `topic` are actually redundant for this Connector.



##########
eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/connector/FileSourceConnector.java:
##########
@@ -73,12 +85,38 @@ public String name() {
 
     @Override
     public void stop() {
-
+        try {
+            if (bufferedReader != null) {
+                bufferedReader.close();
+            }
+        } catch (Exception e) {
+            log.error("Error closing resources: {}", e.getMessage());
+        }
     }
 
     @Override
     public List<ConnectRecord> poll() {
-        return null;
+        List<ConnectRecord> connectRecords = new ArrayList<>();
+        try {
+            int bytesRead;
+            char[] buffer = new char[1024];
+            while ((bytesRead = bufferedReader.read(buffer)) != -1) {
+                String line = new String(buffer, 0, bytesRead);
+                long timeStamp = System.currentTimeMillis();
+                RecordPartition recordPartition = 
convertToRecordPartition(this.sourceConfig.getConnectorConfig().getTopic(), 
fileName);

Review Comment:
   The contents of this object are the same each time it is created. Either 
move it outside `while () {}` or remove it.



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