gustavoschewinski commented on issue #125:
URL: https://github.com/apache/plc4x-extras/issues/125#issuecomment-2316985678

   Hello @chrisdutz,
   
   I am using Confluent Platform 7.6.1 with Apache Kafka 3.6.x.
   
   However, I don't think that is the problem, because I took that into 
consideration when compiling the connector. I am experiencing the same issue 
even when using the connector without Kafka.
   
   Below is the code example where I am testing the connector outside of Kafka:
   
   ```java
   package org.apache.plc4x.kafka;
   
   import static org.junit.jupiter.api.Assertions.assertEquals;
   
   import java.util.*;
   import org.apache.kafka.connect.source.SourceRecord;
   import org.apache.plc4x.kafka.Plc4xSourceConnector;
   import org.apache.plc4x.kafka.Plc4xSourceTask;
   import org.apache.plc4x.kafka.config.Constants;
   import org.slf4j.LoggerFactory;
   import org.slf4j.Logger;
   
   import java.util.HashMap;
   import java.util.List;
   import java.util.Map;
   
   public class ConnectorTest {
   
       private static final Logger log = 
LoggerFactory.getLogger(ConnectorTest.class);
   
       public static void main(String[] args) {
           // Simulate Kafka Connect properties
           Map<String, String> props = new HashMap<>();
           props.put("tasks.max", "1");
           props.put("key.converter", 
"org.apache.kafka.connect.json.JsonConverter");
           props.put("value.converter", 
"org.apache.kafka.connect.json.JsonConverter");
           props.put("default.topic", "DefaultTopic");
   
           props.put("sources", "machineA");
   
           props.put("sources.machineA.connectionString", 
"opcua:tcp://Yoshi.lab.mtu-digilab.io:53530/OPCUA/SimulationServer?discovery=false");
           props.put("sources.machineA.pollReturnInterval", "500");
           props.put("sources.machineA.bufferSize", "1000");
   
           
props.put("sources.machineA.jobReferences.simulated-dashboard.topic", 
"simulated-dashboard-topic"); 
   
           props.put("jobs", "simulated-dashboard");
   
           props.put("jobs.simulated-dashboard.interval", "1000");
   
           props.put("jobs.simulated-dashboard.tags", "running");
   
           props.put("jobs.simulated-dashboard.tags.running", "ns=3;i=1002");
   
           props.put("sources.machineA.jobReferences", "simulated-dashboard");
           
           log.debug("Starting PLC4X Kafka Connector with properties: {}", 
props);
   
           // Instantiate your connector
           Plc4xSourceConnector connector = new Plc4xSourceConnector();
           connector.start(props);
   
           // Get task configurations
           List<Map<String, String>> taskConfigs = connector.taskConfigs(1);
           if (taskConfigs.isEmpty()) {
               log.error("No task configurations found. Please check the 
configuration.");
               return;
           }
   
           // Instantiate task
           Plc4xSourceTask task = new Plc4xSourceTask();
           System.out.println("task" + taskConfigs.get(0));
           task.start(taskConfigs.get(0));
   
           // Simulate polling
           List<SourceRecord> records = task.poll();
           if (records != null && !records.isEmpty()) {
               for (SourceRecord record : records) {
                   System.out.println("Polled Record: " + record);
               }
           } else {
               System.out.println("No records polled.");
           }
   
           // Stop task and connector
           task.stop();
           connector.stop();
       }
   }
   ```
   
   Thanks! I hope we can find where this problem comes from :)
   
   Best,
   Gustavo.


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

Reply via email to