是否有人能够使用IntelliJ IDEA调试用Java 8编写的kafkastreams代码?我正在运行一个简单的linesplit.java代码,该代码从一个主题获取流并将其拆分并发送到另一个主题,但是我不知道在哪里保留调试指针来调试每条流经lineplit.java的消息。 / p>
Linesplit.java
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.put(StreamsConfig.APPLICATION_ID_CONFIG, "streams-linesplit");
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass());
final StreamsBuilder builder = new StreamsBuilder();
// ------- use the code below for Java 8 and uncomment the above ---
builder.stream("streams-input")
.flatMapValues(value -> Arrays.asList(value.toString().split("\\W+")))
.to("streams-output");
// -----------------------------------------------------------------
final Topology topology = builder.build();
final KafkaStreams streams = new KafkaStreams(topology, props);
final CountDownLatch latch = new CountDownLatch(1);
// attach shutdown handler to catch control-c
Runtime.getRuntime().addShutdownHook(new Thread("streams-shutdown-hook") {
@Override
public void run() {
streams.close();
latch.countDown();
}
});
try {
streams.start();
latch.await();
} catch (Throwable e) {
System.exit(1);
}
System.exit(0);
}