1

I am getting below error while running Flink with flink-connector-kafka-0.9 connector .

   Exception in thread "main" java.lang.ClassCastException: org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer cannot be cast to org.apache.flink.streaming.api.functions.source.SourceFunction
at com.dataartisans.ReadFromKafka.main(ReadFromKafka.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Initially I was able to fetch records from Kafka . But now getting the above error .

1 Answer 1

1

A FlinkKafkaProducer08 is not a source function but a sink function. The producer has the task to emit elements to Kafka. In contrast to that, the FlinkKafkaConsumer08 is the source function which reads data from Kafka.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.