Camel-Kafka component not workingfor error :"because of Brokers must be configured"
Camel-Kafka component not workingfor error :"because of Brokers must be configured"
使用 Apache Camel(版本 2.19.1)的 kafka 组件时出错,我只是想在主题中打印传入的消息,我的管道是如此复杂:
...
context.addRoutes(new RouteBuilder() {
public void configure() {
from("kafka://localhost:9092?topic=test&groupId=testing")
.to("stream:out");
context.start();
}
}
尝试在端点中使用和不使用“//”。
我得到的是:
Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[kafka://localhost:9092?topic=test&groupI... because of Brokers must be configured
at org.apache.camel.impl.RouteService.warmUp(RouteService.java:147)
at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3762)
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3669)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3455)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3309)
at org.apache.camel.impl.DefaultCamelContext.access[=11=]0(DefaultCamelContext.java:202)
at org.apache.camel.impl.DefaultCamelContext.call(DefaultCamelContext.java:3093)
at org.apache.camel.impl.DefaultCamelContext.call(DefaultCamelContext.java:3089)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3112)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3089)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3026)
at org.apache.camel.MainApp.main(MainApp.java:60)
Caused by: java.lang.IllegalArgumentException: Brokers must be configured
at org.apache.camel.component.kafka.KafkaConsumer.<init>(KafkaConsumer.java:62)
at org.apache.camel.component.kafka.KafkaEndpoint.createConsumer(KafkaEndpoint.java:76)
at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69)
at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:103)
at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172)
at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)
... 12 more
Process finished with exit code 1
我正在尝试弄清楚,但我真的不明白问题出在哪里,我的 kafka 集群是一个单一的代理,并且一切正常 运行(zookeeper 和服务器),ty帮助
将 brokers=localhost:9092
添加到消费者 uri。
查看 this example URL 的第一部分是 topic
,然后您可以将 brokers
作为参数传递。所以官方文档好像有点误导我。
from("kafka:{{consumer.topic}}?brokers={{kafka.host}}:{{kafka.port}}"
+ "&maxPollRecords={{consumer.maxPollRecords}}"
+ "&consumersCount={{consumer.consumersCount}}"
+ "&seekTo={{consumer.seekTo}}"
+ "&groupId={{consumer.group}}")
.routeId("FromKafka")
.log("${body}");
但作为一般性建议:Camel 是 open source,因此您可以随时查看 github 上的代码和示例。您还可以找到您在此处发布的那些堆栈跟踪行,然后查找丢失的内容。
使用 Apache Camel(版本 2.19.1)的 kafka 组件时出错,我只是想在主题中打印传入的消息,我的管道是如此复杂:
...
context.addRoutes(new RouteBuilder() {
public void configure() {
from("kafka://localhost:9092?topic=test&groupId=testing")
.to("stream:out");
context.start();
}
}
尝试在端点中使用和不使用“//”。
我得到的是:
Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[kafka://localhost:9092?topic=test&groupI... because of Brokers must be configured
at org.apache.camel.impl.RouteService.warmUp(RouteService.java:147)
at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3762)
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3669)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3455)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3309)
at org.apache.camel.impl.DefaultCamelContext.access[=11=]0(DefaultCamelContext.java:202)
at org.apache.camel.impl.DefaultCamelContext.call(DefaultCamelContext.java:3093)
at org.apache.camel.impl.DefaultCamelContext.call(DefaultCamelContext.java:3089)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3112)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3089)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3026)
at org.apache.camel.MainApp.main(MainApp.java:60)
Caused by: java.lang.IllegalArgumentException: Brokers must be configured
at org.apache.camel.component.kafka.KafkaConsumer.<init>(KafkaConsumer.java:62)
at org.apache.camel.component.kafka.KafkaEndpoint.createConsumer(KafkaEndpoint.java:76)
at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69)
at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:103)
at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172)
at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)
... 12 more
Process finished with exit code 1
我正在尝试弄清楚,但我真的不明白问题出在哪里,我的 kafka 集群是一个单一的代理,并且一切正常 运行(zookeeper 和服务器),ty帮助
将 brokers=localhost:9092
添加到消费者 uri。
查看 this example URL 的第一部分是 topic
,然后您可以将 brokers
作为参数传递。所以官方文档好像有点误导我。
from("kafka:{{consumer.topic}}?brokers={{kafka.host}}:{{kafka.port}}"
+ "&maxPollRecords={{consumer.maxPollRecords}}"
+ "&consumersCount={{consumer.consumersCount}}"
+ "&seekTo={{consumer.seekTo}}"
+ "&groupId={{consumer.group}}")
.routeId("FromKafka")
.log("${body}");
但作为一般性建议:Camel 是 open source,因此您可以随时查看 github 上的代码和示例。您还可以找到您在此处发布的那些堆栈跟踪行,然后查找丢失的内容。