|
Hi,
I am a beginner with Apache Flink. I am trying to write to Kafka through
a file and read the data from kafka. I see there is an API to read from and
write to kafka.
The following writes to kafka
FlinkKafkaProducer08<String> myProducer = new FlinkKafkaProducer08<String>(
"localhost:9092", // broker list
"my-topic", // target topic
new SimpleStringSchema()); // serialization schema
Is there any API which takes input as file and writes the file content to
kafka ?
My second question
-------------------------
I have run the kafka producer on the terminal
I am trying to read from kafka using the below code. But this doesn't print
any output though I am giving some input in the producer terminal.
The program quickly executes comes out. Please let me know how I can read
from kafka ?
DataStream<String> data = env.addSource(new
FlinkKafkaConsumer010<String>("myTopic",new SimpleStringSchema(),
props)).print();
|