Writing Data in form of JSON from Flink to a file

By Arch

When we were trying to write the processed JSON data from Flink into file using the method writeAsCsv(path, writemode), the dta as written into the file but we need to insert comma after every JSON which is not happening. We are using Apache Kafka as data source to Flink.

DataStream<Tuple5<String, String, String, String, String>> messageStream = env.addSource(new FlinkKafkaConsumer08<>(FLINK_TOPIC, new SimpleStringSchema(), properties)).flatMap(new StreamToTuple5()).keyBy(0);
String path = "/home/user/Documents/docs/csvfile/";
messageStream.writeAsCsv(path, FileSystem.WriteMode.OVERWRITE);

the output obtaining on executing this method is


Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273