The solution is to check the source topic’s serialization format, and either switch Kafka Connect’s sink connector to use the correct converter, or switch the upstream format to Avro (which is a good idea). If the upstream topic is populated by Kafka Connect, then you can configure the source connector’s converter as follows:
"value.converter": "io.confluent.connect.avro.AvroConverter", "value.converter.schema.registry.url": "http://schema-registry:8081",
it doesn't work
The solution is to check the source topic’s serialization format, and either switch Kafka Connect’s sink connector to use the correct converter, or switch the upstream format to Avro (which is a good idea). If the upstream topic is populated by Kafka Connect, then you can configure the source connector’s converter as follows:
"value.converter": "io.confluent.connect.avro.AvroConverter", "value.converter.schema.registry.url": "http://schema-registry:8081",it doesn't work
On Wednesday, April 24, 2019 at 12:50:22 PM UTC-5, Max Li wrote:
source DB: mongodbkafka: confluent 5.12target: elastcisearchfrom mongodb to kafka, it is working well
[oracle@houbiap5 confluent5]$ bin/kafka-console-consumer --bootstrap-server houbiap5:9092 --topic customers --from-beginning{"after":null,"patch":null,"source":{"version":"0.9.4.Final","connector":"mongodb","name":"mongodbTest","rs":"mongo01","ns":"inventory.customers","sec":1556119323,"ord":1,"h":1255747003695718904,"initsync":false},"op":"d","ts_ms":1556119323326}null{"after":null,"patch":null,"source":{"version":"0.9.4.Final","connector":"mongodb","name":"mongodbTest","rs":"mongo01","ns":"inventory.customers","sec":1556119323,"ord":2,"h":-3344312220964857180,"initsync":false},"op":"d","ts_ms":1556119323328}null{"after":null,"patch":null,"source":{"version":"0.9.4.Final","connector":"mongodb","name":"mongodbTest","rs":"mongo01","ns":"inventory.customers","sec":1556119323,"ord":3,"h":8650281562576212760,"initsync":false},"op":"d","ts_ms":1556119323328}null{"after":null,"patch":null,"source":{"version":"0.9.4.Final","connector":"mongodb","name":"mongodbTest","rs":"mongo01","ns":"inventory.customers","sec":1556119323,"ord":4,"h":7307862537196435761,"initsync":false},"op":"d","ts_ms":1556119323328}null{"after":null,"patch":null,"source":{"version":"0.9.4.Final","connector":"mongodb","name":"mongodbTest","rs":"mongo01","ns":"inventory.customers","sec":1556119323,"ord":5,"h":7141663475881294335,"initsync":false},"op":"d","ts_ms":1556119323328}null
{"after":"{\"_id\" : {\"$numberLong\" : \"1001\"},\"first_name\" : \"Sally\",\"last_name\" : \"Thomas\",\"email\" : \"sally...@acme.com\"}","patch":null,"source":{"version":"0.9.4.Final","connector":"mongodb","name":"mongodbTest","rs":"mongo01","ns":"inventory.customers","sec":1556119356,"ord":1,"h":-8203394498065317421,"initsync":false},"op":"c","ts_ms":1556119356396}