如何访问Flink Map中在外面声明的Java变量?
我正在Java创建列表。我想在Flink中的地图功能中分享列表。如何在跨链接过程中共享变量
要求 我有静态数据记录(少于1000个记录)。我想将这些记录与数据流一起加入。
I am creating a List in Java. I want to share the List within the map function in flink. How to share the variables across flink processes
Requirement
I have static data records(Less than 1000 records). I want to join these records with the data stream.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Flink的设计考虑了可扩展性,因此它体现了A 共享方法。操作员可以是有状态的,但其状态严格是本地的,对其他运营商看不到。
在这种特殊情况下,一个好的解决方案可能是使用
richmapfunction
(或richflatmapfunction
)进行加入,并将所有静态数据记录的副本加载到其Open
方法中的本地瞬态数据结构。Flink is designed with scalability in mind, and so it embodies a share nothing approach. An operator can be stateful, but its state is strictly local and not visible to other operators.
In this particular case, a good solution might be to use a
RichMapFunction
(orRichFlatMapFunction
) to do the join, and to load a copy of all of the static data records into a local transient data structure in itsopen
method.