且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当processElement依赖于广播的数据时,如何在flink中对BroadcastProcessFunction进行单元测试

更新时间:2023-02-03 22:11:31

没有简单的方法可以做到这一点.您可以让processElement缓冲其所有输入,直到processBroadcastElement收到模型为止.或在无事件流量的情况下运行一次作业,并在广播模型后获取保存点.然后将该保存点还原到同一作业中,但连接其事件输入.

There isn't an easy way to do this. You could have processElement buffer all of its input until the model has been received by processBroadcastElement. Or run the job once with no event traffic and take a savepoint once the model has been broadcast. Then restore that savepoint into the same job, but with its event input connected.

顺便说一句,您正在寻找的功能在Flink社区中通常称为辅助输入".

By the way, the capability you are looking for is often referred to as "side inputs" in the Flink community.