带有Apache Beam的KafkaIO卡在DirectRunner的无限循环中

时间:2020-06-21 18:30:55

标签: apache-beam apache-beam-kafkaio

我正在尝试运行一个简单的示例,其中将滤除Kafka主题中的数据:https://www.talend.com/blog/2018/08/07/developing-data-processing-job-using-apache-beam-streaming-pipeline/

我对本地代理具有默认设置的类似设置,但我什至无法阅读该主题。

运行应用程序时,它陷入了无限循环,没有任何反应。我尝试给经纪人提供乱码,以查看它是否甚至可以访问他们-事实并非如此。群集已启动并正在运行,我能够向该主题添加消息。这是我指定经纪人和主题的地方:

        pipeline
            .apply(
                    KafkaIO.<Long, String>read()
                            .withBootstrapServers("localhost:9092")
                            .withTopic("BEAM_IN")
                            .withKeyDeserializer(LongDeserializer.class)
                            .withValueDeserializer(StringDeserializer.class)
                            )

我没有看到任何错误,也没有任何内容写入输出主题。

调试时,我发现它陷入了这个循环:

        while(Instant.now().isBefore(completionTime)) {
        ExecutorServiceParallelExecutor.VisibleExecutorUpdate update = this.visibleUpdates.tryNext(Duration.millis(25L));
        if (update == null && ((State)this.pipelineState.get()).isTerminal()) {
            return (State)this.pipelineState.get();
        }

        if (update != null) {
            if (this.isTerminalStateUpdate(update)) {
                return (State)this.pipelineState.get();
            }

            if (update.thrown.isPresent()) {
                Throwable thrown = (Throwable)update.thrown.get();
                if (thrown instanceof Exception) {
                    throw (Exception)thrown;
                }

                if (thrown instanceof Error) {
                    throw (Error)thrown;
                }

                throw new Exception("Unknown Type of Throwable", thrown);
            }
        }

在ExecutorServiceParallelExecutor类的isKeyed(PValue pvalue)方法中。

我想念什么?

0 个答案:

没有答案