DataStream<String> dataStream = env.addSource(new SourceFunction<String>() {
private static final long serialVersionUID = 1L;
private volatile boolean isRunning = true;
private long count = 0;
@Override
public void run(SourceContext<String> out) throws Exception {
while (isRunning) {
count++;
if (count % 600000000 == 0) {
out.collect(String.valueOf(Math.floor(Math.random() * 100)));
}
}
}
@Override
public void cancel() {
isRunning = false;
}
});
dataStream.writeUsingOutputFormat(new HBaseOutputFormat());
最简单的一个dataframe,