Я хочу использовать Operator State API
в No-Keyed Stream
для сохранения состояния count
в примере ниже. что мне делать?
public static class MapFunction implements MapFunction<String, String>,CheckpointedFunction{
int count = 0;
@Override
public String map(String value) throws Exception {
// TODO Auto-generated method stub
String message;
message = value;
count++;
return message;
}
@Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
// TODO Auto-generated method stub
}
@Override
public void initializeState(FunctionInitializationContext context) throws Exception {
// TODO Auto-generated method stub
}
}
Спасибо за ваш ответ.