java—我的FlinkKafkaProducer011需要的参数比预期的要少


0

我对FlinkKafkaConnector有困难。

虽然我已经进口了org.apache.flink网站.streaming.connectors.kafka.FlinkKafkaProducer011,我得到以下错误。

Too many arguments for constructor FlinkKafkaProducer011

root据这个网站的说法,这些论点是正确的。然而,我的智能显示了这个定义。

public FlinkKafkaProducer011() {
}

有人知道怎么修理吗?

更新

这是IDE的定义。

public class FlinkKafkaProducer011 {
    public FlinkKafkaProducer011() {
    }

public static class NextTransactionalIdHint extends org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.NextTransactionalIdHint {
    public NextTransactionalIdHint() {
    }
}

public static class TransactionStateSerializer {
    public TransactionStateSerializer() {
    }

    public static final class TransactionStateSerializerSnapshot extends SimpleTypeSerializerSnapshot<KafkaTransactionState> {
        public TransactionStateSerializerSnapshot() {
            super(org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.TransactionStateSerializer::new);
        }
    }
}

public static class ContextStateSerializer {
    public ContextStateSerializer() {
    }

    public static final class ContextStateSerializerSnapshot extends SimpleTypeSerializerSnapshot<KafkaTransactionContext> {
        public ContextStateSerializerSnapshot() {
            super(org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.ContextStateSerializer::new);
        }
    }
}

public static class NextTransactionalIdHintSerializer {
    public NextTransactionalIdHintSerializer() {
    }

    public static final class NextTransactionalIdHintSerializerSnapshot extends SimpleTypeSerializerSnapshot<org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.NextTransactionalIdHint> {
        public NextTransactionalIdHintSerializerSnapshot() {
            super(org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.NextTransactionalIdHintSerializer::new);
        }
    }
}

}

1 答案


0

请您说明一下您使用的flink connector kafka版本好吗?

据我所见org.apache.flink网站.streaming.connectors.kafka您使用的.FlinkKafkaProducer011只是flink-connector-kafka_2.11 jar中的一个兼容性类,正确的producer使用的是org.apache.flink网站.streaming.connectors.kafkaFlinkKafkaProducer公司。

据我所知,javadochttps://ci.apache.org/projects/flink/flink-docs-release-1.4/api/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer011.html与…相关org.apache.flink网站.streaming.connectors.kafka.FlinkKafkaProducer011制作人来自flink-connector-kafka-0.11_2.11工件。

所以,我建议要么换成org.apache.flink网站.streaming.connectors.kafka.FlinkKafkaProducer或将依赖关系更改为flink-connector-kafka-0.11_2.11 jar。


我来回答

写文章

提问题

面试题