[英]Serialization in the Hazelcast IMap
I'm trying to load data into IMap inside jet pipeLine stage I'm getting the error我正在尝试将数据加载到 jet pipeLine 阶段内的 IMap 我收到错误
Here is my code这是我的代码
public static Pipeline pipeLineStage(JetInstance jet) {
Pipeline pipeLine = Pipeline.create();
BatchStage<DataModel> dbValue = pipeLine.readFrom(Sources.jdbc(
"jdbc:postgresql://localhost/postgres?user=postgres&password=root",
"SELECT id1, id2, id3, id4\r\n"
+ " FROM public.tbl_test where id1='3'",
resultSet -> new DataModel(resultSet.getString(2), resultSet.getString(3), resultSet.getString(4))));
dbValue.filter(model -> model.getId2().equals("person"))
.map(model -> JsonUtil.mapFrom(model.getObject_value())).map(map -> {
IMap<Object, Object> map1 = jet.getMap("map1");
map1.put("employee_id", map.get("id"));
return map;
}).writeTo(Sinks.logger());
return pipeLine;
}
Error:-错误:-
Exception in thread "main" java.lang.IllegalArgumentException: "mapFn" must be serializable
at com.hazelcast.jet.impl.util.Util.checkSerializable(Util.java:203)
*If I store the data in a normal Map
I'm not getting any error and getting error only if I store in IMap
Object and In the above code I'm using model class i,e DataModel
and that implements public class DataModel implements Serializable {}
..... Any suggestions would also be helpful.. Thanks * *If I store the data in a normal
Map
I'm not getting any error and getting error only if I store in IMap
Object and In the above code I'm using model class i,e DataModel
and that implements public class DataModel implements Serializable {}
..... 任何建议也会有所帮助.. 谢谢 *
It appears that you have configured a serialization factory by the name of mapFn which requires serialization.看来您已经配置了一个名为 mapFn 的序列化工厂,它需要序列化。 Simply add implements Serializable to the class definition.
只需将实现 Serializable 添加到 class 定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.