小编Vij*_*apu的帖子

如何调试kafkastreams代码?

有没有人设法使用 IntelliJ IDEA 调试用 Java 8 编写的 kafkastreams 代码?我正在运行一个简单的 linesplit.java 代码,它从一个主题中获取流并将其拆分并将其发送到另一个主题,但我不知道在哪里保存调试指针以在每条消息流经 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); …
Run Code Online (Sandbox Code Playgroud)

java apache-kafka apache-kafka-streams

8
推荐指数
1
解决办法
2761
查看次数

标签 统计

apache-kafka ×1

apache-kafka-streams ×1

java ×1