01
//3. 将读取出来的json字符串转换为ItcastDataObj
SingleOutputStreamOperator<ItcastDataObj> vehicleDataStream = source.map(
new MapFunction<String, ItcastDataObj>() {
@Override
public ItcastDataObj map(String line) throws Exception {
return JsonParseUtil.parseJsonToObject(line);
}
}
);
//-- 另种写法
DataStream<ItcastDataObj> vehicleDataStream02 = source.map(JsonParseUtil::parseJsonToObject);