Staff Software Practice Lead
One of the powerful features of Flink is its ability to maintain state in a datastream. This state can be kept local to the operation being performed which can improve performance by eliminating network hops. In this video, we'll introduce keyed state in Flink and show you how you can use it to maintain state across messages and even windows.
Topics:
private ValueStateDescriptor<MyClass> descriptor;
@Override
public void open(Configuration parameters) {
descriptor = new ValueStateDescriptor<>(
"Identifier",
MyClass.class
);
descriptor.enableTimeToLive(ttlConfig);
...
}
public void process(...) {
ValueState<MyClass> state = context
.globalState()
.getState(descriptor);
MyClass value = state.value();
if(value == null) {
...
} else {
...
}
state.update(value);
}
We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.