getRuntimeContext(): The runtime context has not been initialized.
Posted by
hassahma on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/getRuntimeContext-The-runtime-context-has-not-been-initialized-tp23718.html
Hi,
We want to use MapState inside fold function to keep the map of all products that we see in 24 hour window to store huge state in rocksdb rather than overflowing heap. However, I don't seem to initialise mapstate within foldfunction or any class that is extending RichMapFunction
private transient MapStateDescriptor<String, String> descr = new MapStateDescriptor<>("mymap", String.class, String.class);
this.getRuntimeContext().getMapState(descr);
I get error
java.lang.IllegalStateException: The runtime context has not been initialized.
at org.apache.flink.api.common.functions.AbstractRichFunction.getRuntimeContext(AbstractRichFunction.java:53)
Any clues how to get the runtime context please?
Thanks.
Best regards