How to output one data stream to different outputs depending on the data?

后端 未结 1 1348
时光说笑
时光说笑 2021-02-05 08:05

In Apache Flink I have a stream of tuples. Let\'s assume a really simple Tuple1. The tuple can have an arbitrary value in it\'s value field (e.g. \'P1

相关标签:
1条回答
  • 2021-02-05 08:47

    You can implement a custom sink. Inherit from one of both:

    • org.apache.flink.streaming.api.functions.sink.SinkFunction
    • org.apache.flink.streaming.api.functions.sink.RichSinkFunction

    In your program use:

    stream.addSink(SinkFunction<T> sinkFunction);
    

    instead of stream.writeCsv("/output/somewhere").

    0 讨论(0)
提交回复
热议问题