我收到 Pipeline customTransform
API 的以下编译错误。
这是构建管道的示例代码:
private Pipeline buildPipeline2() {
Pipeline p = Pipeline.create();
p.drawFrom(Sources.<String, CacheEntry<AuditLogRecord>>remoteMapJournal("cache_AuditLog", getClientConfig(), START_FROM_OLDEST))
.addTimestamps((v) -> getTimeStamp(v), 3000)
.peek()
.groupingKey((v) -> Tuple2.tuple2(getUserID(v),getTranType(v)))
.window(WindowDefinition.sliding(SLIDING_WINDOW_LENGTH_MILLIS, SLIDE_STEP_MILLIS))
//.aggregate(counting(),(winStart, winEnd, key, result) -> String.format("%s %5s %4d", toLocalTime(winEnd), formatKey(key), result))
.aggregate(counting())
.map((v)-> getMapKey(v))
.customTransform("test2", ()-> this)
.drainTo(Sinks.map("Test"));
//.drainTo(Sinks.files("c:\\data\\op.txt"));
return p;
}
这是tryProcess()
方法的示例代码:
protected boolean tryProcess(int ordinal, Object item) {
JetEvent jetEvent = (JetEvent)item;
Object obj = jetEvent.payload();
tryEmit(ordinal,item);
return true;
}
这是编译错误。
incompatible types: inferred type does not conform to upper bound(s)
[ERROR] inferred: java.lang.Object
[ERROR] upper bound(s): java.util.Map.Entry
这可以使用以下代码编译并运行良好。
.customTransform("test2", ()-> this)
.drainTo(Sinks.files("c:\\data\\op.txt"));
但是,下面的代码给出了编译错误。
.customTransform("test2", ()-> this)
.drainTo(Sinks.map("Test"));
你能帮我解决这个问题吗?