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

查看:31
本文介绍了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天全站免登陆