Search code examples
apache-flink

How to use broadcast variables such as list in flink streaming program?


I want to use some other broadcast resources such as list or map in the flatmap function or customer triggers, but I don’t find some api to satisfy.

I find the broadcast method, but it's return the datastream, and how can i convert it to list, and how can i get it in streamcontext?

I use Flink-1.3.2.


Solution

  • If you are referring to Flink's broadcast state, then this was only introduce with Flink 1.5.

    If you are referring to DataStream#broadcast() which controls the partitioning of records, then this won't allow you to specify a broadcast state. You will have to implement that on your own by specifying a corresponding CoFlatMapFunction, for example.