Hi everyone! I am a newbee in Filnk, don't throw ...
# troubleshooting
v
Hi everyone! I am a newbee in Filnk, don't throw tomatoes 🍅 to me in case of stupid question 🙂 My env: • Java: 17.0.10 2024-01-16 LTS • Flink: 1.18.1 (I'm going to use DataStream API) • Kafka cluster: 3.5.0 • Debezium (MariaDB -> Kafka) with serialization in Avro format • Bitnami (Confluent) Schema Registry Seems like there is no solution to automatically synchronise latest schema of Confluent Schema Registry with data in Kafka-topic. Hence I manually added schema by coping from Confluent Schema Registry API response. Schema will be attached in a thread. I launched my Flink application with following code:
Copy code
package com.zfx.topbook;

import io.confluent.kafka.serializers.subject.TopicRecordNameStrategy;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;
import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.api.common.serialization.DeserializationSchema;
import org.apache.flink.connector.kafka.source.KafkaSource;
import org.apache.flink.connector.kafka.source.enumerator.initializer.OffsetsInitializer;
import org.apache.flink.formats.avro.registry.confluent.ConfluentRegistryAvroDeserializationSchema;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import io.confluent.kafka.serializers.KafkaAvroDeserializerConfig;
import java.util.Properties;


public class TopBook {
    public static void main(String[] args) throws Exception {

        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        Properties properties = new Properties();
        Schema avroSchema = new Schema.Parser().parse(properties.getProperty("avro.schema"));
//        DeserializationSchema<GenericRecord> deserializer = AvroDeserializationSchema.forGeneric(avroSchema);
        DeserializationSchema<GenericRecord> deserializer = ConfluentRegistryAvroDeserializationSchema.forGeneric(avroSchema);

        KafkaSource<GenericRecord> source = KafkaSource.<GenericRecord>builder()
                .setBootstrapServers(properties.getProperty("bootstrap.servers"))
                .setTopics(properties.getProperty("topic"))
                .setGroupId(properties.getProperty("group.id"))
                .setStartingOffsets(OffsetsInitializer.latest())
                .setValueOnlyDeserializer(deserializer)
                .setProperties(properties)
                .build();

        env.fromSource(
                source,
                WatermarkStrategy.forMonotonousTimestamps(),
                "Kafka Source"
            )
            .print();

        env.execute();

    }

}
Finally I'm getting an error (full message will be attached to thread:
Copy code
Caused by: java.io.IOException: Failed to deserialize consumer record due to
Can you help me to figure out what's wrong with that?
Schema
Full state trace