Flink: does state access across stream?

2019-08-16 05:11发布

问题:

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.

回答1:

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.

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.



回答2:

Depending on how you need to use the state, it might be possible to leverage queryable state to share it with another stream.