Sink介绍
在Fink官网中sink端只是给出了常规的write api.在我们实际开发场景中需要将flink处理的数据写入kafka,hbase kudu等外部系统。
UML关系
自定义Sink需要实现父类的接口和继承抽象类。
上面是Sink的继承关系
Flink addSink
// 方法需要SinkFunction的对象
public DataStreamSink<T> addSink(SinkFunction<T> sinkFunction) {
// read the output type of the input Transform to coax out errors about MissingTypeInfo
transformation.getOutputType();
// configure the type if needed
if (sinkFunction instanceof InputTypeConfigurable) {
((InputTypeConfigurable) sinkFunction).setInputType(getType(), getExecutionConfig());
}
StreamSink<T> sinkOperator = new StreamSink<>(clean(sinkFunction));
DataStreamSink<T> sink = new

本文介绍了如何在 Apache Flink 中实现自定义 Sink 函数,以将数据写入外部系统如 HBase,并提供了详细的代码示例。
最低0.47元/天 解锁文章
1472

被折叠的 条评论
为什么被折叠?



