PLC4X OPCUA -Kafka Connnector

733 views Asked by At

I want to use the PLC4X Connector (https://www.confluent.io/hub/apache/kafka-connect-plc4x-plc4j) to connect OPC UA (Prosys Simulation Server) with Kafka.

However I really do not find any website that describe the kafka connect configuration options?

I tried to connect to the prosys opc ua simulation server and than stream the data to a kafka topic. I managed it to simply send the data and consume it, however i want to use a schema and the avro connverter.

My output from my sink python connector looks like this. That seems a bit strange to me too?

b'Struct{fields=Struct{ff=-5.4470555688606E8,hhh=Sean Ray MD},timestamp=1651838599206}'

How can I use the PLC4X connector with the Avro converter and a Schema?

Thanks!

{
 "connector.class": "org.apache.plc4x.kafka.Plc4xSourceConnector",
  "default.topic":"plcTestTopic",
  "connectionString":"opcua.tcp://127.0.0.1:12345",
  "tasks.max": "2",
  "sources": "machineA",
  "sources.machineA.connectionString": "opcua:tcp://127.0.0.1:12345",
  "sources.machineA.jobReferences": "jobA",
  "jobs": "jobA",
  "jobs.jobA.interval": "5000",
  "jobs.jobA.fields": "job1,job2",
  "jobs.jobA.fields.job1": "ns=2;i=2",
  "jobs.jobA.fields.job2": "ns=2;i=3"
}
1

There are 1 answers

0
Ben Hutcheson On

When using a schema with Avro and the Confluent schema registry, the following settings should be used. You can also choose to use different settings for both the keys and values.

key.converter=io.confluent.connect.avro.AvroConverter
value.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url:http://127.0.0.1:8081
value.converter.schema.registry.url:http://127.0.0.1:8081
key.converter.schemas.enable=true
value.converter.schemas.enable=true

Sample configuration files are also available in the PLC4X Github repository.

https://github.com/apache/plc4x/tree/develop/plc4j/integrations/apache-kafka/config