Hello Everyone, Actually i am new to Apache flink ...
# troubleshooting
a
Hello Everyone, Actually i am new to Apache flink and i am writing some code to process the DataStream coming from Ti-cdc. Below is the code by which on each data from DataStream i am call my method
groupEvalEvant
. This code is working fine when i am running in local, but as i am uploading jar in flink UI, there this code is not working. logs inside
processElement
method are not getting in Job manager. Means it is not entering inside processElement function.
Copy code
@Override
    public DataStream<EntityEvalEvent> processStream() throws Exception {
        StreamExecutionEnvironment env = setUpEnvironment(); //call
        env.enableCheckpointing(5000); // Checkpoint every 5 seconds
        // Create a Kafka consumer using FlinkKafkaConsumer
        Properties kafkaProps = setUpKafkaProperties();//call

        DataStream<EntityEvalEvent> stream = env
                .addSource(new FlinkKafkaConsumer<EntityEvalEvent>(PRODFlinkJobProperties.SOURCE_TOPIC, new EntityWrapperDeserializationSchema(), kafkaProps)); //Ti-cdc will push to SOURCE_TOPIC

        // Process the Kafka message
        SingleOutputStreamOperator<EntityEvalEvent> processedStream = stream.process(new ProcessFunction<EntityEvalEvent, EntityEvalEvent>() {
            @Override
            public void processElement(EntityEvalEvent value, Context ctx, Collector<EntityEvalEvent> out) {
                out.collect(value);
                log.info("Collecting value ------------- {}", value);
            }
        });

        log.info("Before source ---------- ");

        DataStream<EntityEvalEvent> result = processedStream.map((MapFunction<EntityEvalEvent, EntityEvalEvent>) entityData -> {
            try {
                log.info("Start 3");
                log.info("Entity recieved after Ticdc ================== " + entityData);
                //Reached here...
                receiveGroupEvalEvent(entityData);
            } catch (Exception e) {
                e.printStackTrace();
            }
            log.info("Entity data from processStream.map -------- ");
            return entityData; // The return type of the map transformation doesn't matter since it's void
        });

        processedStream.print();
        log.info("Sink ----------------- ");
        processedStream.addSink(new FlinkKafkaProducer<EntityEvalEvent>(PRODFlinkJobProperties.DESTINATION_TOPIC, new EntityWrapperSerializationSchema(), kafkaProps));



        env.execute("Kafka to flink");
        return processedStream;
    }
So i changed the code to below. Here also i am getting the log
Before source ----------
and
log.info("Sink ----------------- ");
. Here also code is no entering into
processElement
function.
Copy code
@Override
    public DataStream<EntityEvalEvent> processStream() throws Exception {
        log.info("Process Stream started ---------------------");
        StreamExecutionEnvironment env = setUpEnvironment();
        env.enableCheckpointing(5000); // Checkpoint every 5 seconds
        // Create a Kafka consumer using FlinkKafkaConsumer
        Properties kafkaProps = setUpKafkaProperties();
        log.info("Before source ---------- ");

        DataStream<EntityEvalEvent> stream = env
                .addSource(new FlinkKafkaConsumer<EntityEvalEvent>(PRODFlinkJobProperties.SOURCE_TOPIC, new EntityWrapperDeserializationSchema(), kafkaProps));

        // Process the Kafka message
        SingleOutputStreamOperator<EntityEvalEvent> processedStream = stream.process(new ProcessFunction<EntityEvalEvent, EntityEvalEvent>() {

            @Override
            public void processElement(EntityEvalEvent value, Context ctx, Collector<EntityEvalEvent> out) {
                log.info("Before try -------- ");
                try {
                    log.info("Entity received after Ticdc ================== {}", value);
                    receiveGroupEvalEvent(value);
                    out.collect(value);
                    log.info("Collecting value after group eval event------------- {}", value);
                } catch (Exception e) {
                    e.printStackTrace();
                    log.info("Exception +++++++ " + e.getMessage());
                    // You might want to handle the exception or log it here.
                }
            }
        });

        processedStream.print();
        log.info("Sink ----------------- ");
        processedStream.addSink(new FlinkKafkaProducer<EntityEvalEvent>(PRODFlinkJobProperties.DESTINATION_TOPIC, new EntityWrapperSerializationSchema(), kafkaProps));

        env.execute("Kafka to flink");
        return processedStream;
    }
I am not getting what is the problem. Please suggest if anything wrong i am doing.