Apache camel 骆驼卡夫卡动物园管理员例外

Apache camel 骆驼卡夫卡动物园管理员例外,apache-camel,apache-kafka,Apache Camel,Apache Kafka,我正在启动一个camel kafka consumer,它从topic获取所有数据并移动到hashmap。camel Kafka的Jar版本是2.18.1 cxfbeans.xml文件如下所示: <route id="Test1" streamCache="true"> <from uri="file:C:/data" /> <split streaming="true"> <tokeniz

我正在启动一个camel kafka consumer,它从topic获取所有数据并移动到hashmap。camel Kafka的Jar版本是2.18.1

cxfbeans.xml文件如下所示:

    <route id="Test1" streamCache="true">
        <from uri="file:C:/data" />
        <split streaming="true">
            <tokenize token="\n" />
            <to uri="bean:proc1" />
            <to
                uri="kafka:localhost:9092?topic=Checking&amp;zookeeperHost=localhost&amp;zookeeperPort=2181&amp;serializerClass=kafka.serializer.StringEncoder" />
        </split>
    </route>


如果我部署战争,我会得到以下例外:

原因:org.apache.camel.ResolveEndpointFailedException:未能解析终结点:kafka://localhost:9092?serializerClass=kafka.serializer.StringEncoder&topic=Checking&zookeeperHost=localhost&zookeeperPort=2181 原因:有2个参数无法在端点上设置。如果参数拼写正确并且是端点的属性,请检查uri。未知参数=[{zookeeperHost=localhost,zookeeperPort=2181}]

我试着移除zookeeper的端口和主机,它得到了部署,但消费者并没有消费和放置在处理器中


谁能帮我解决这个问题。我将版本降级为,但我需要在to标记中指定反序列化程序类。

使用camel kafka时,版本=2.17会有所不同

您使用的适用于2.16

有关>=2.17的信息,请参见2.17或更新的部分

这里有一个例子:

from("direct:start").process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
                        exchange.getIn().setBody("Test Message from Camel Kafka Component Final",String.class);
                        exchange.getIn().setHeader(KafkaConstants.PARTITION_KEY, 0);
                        exchange.getIn().setHeader(KafkaConstants.KEY, "1");
                    }
                }).to("kafka:localhost:9092?topic=test");