Flink:是否声明跨流访问? [英] Flink: does state access across stream?

查看:160
本文介绍了Flink:是否声明跨流访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个流将要存储状态,我希望另一个流可以检索该状态.这可能吗?

I have one stream is going to store the state, and I hope another stream can retrieve the state. Is this possible?

我在单元测试中尝试过似乎不起作用.

I have tried in my unit test that seems like doesn't work.

推荐答案

当前不可能有不同的流共享状态.甚至属于同一流的不同运算符也无法共享状态.

It is currently not possible that different streams share state. Even different operators which belong to the same stream are not able to share state.

您唯一可以使用的方法是使用静态字段在不同线程之间共享状态,从而在流之间共享状态.但这仅在不同的任务由相同的TaskManager执行并因此在同一JVM中运行的情况下有效.

The only thing you could play with is to use static fields to share state across different threads and thus also streams. But this only works if different tasks are executed by the same TaskManager and, thus, run in the same JVM.

这篇关于Flink:是否声明跨流访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆