builder.stream("streams-file-input").mapValues(value -> value.toString()).to("streams-file-input");
输出不对吧
测试了,发现没有任何输出,请问是什么原因呢?程序如下:
Map<String, Object> props = new HashMap<>();
props.put(StreamsConfig.APPLICATION_ID_CONFIG, "my-stream-processing-application");
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "hadoop-sh1-core3:9092");
props.put(StreamsConfig.KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName());
props.put(StreamsConfig.VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName());
StreamsConfig config = new StreamsConfig(props);
KStreamBuilder builder = new KStreamBuilder();
builder.stream("streams-file-input").mapValues(value -> value.toString()).to("streams-file-input");
KafkaStreams streams = new KafkaStreams(builder, config);
streams.start();
请教,编译错误 Error:java: Compilation failed: internal java compiler error 怎么回事呢?
纠正一下:上面的Lambda表达式表述有误,应该是
value -> value.toString().length()