[英]bonsai kafka unable to connect from apache camel
I am trying to connect to bonsai kafka clustur from apche camel springboot app .我正在尝试从 apche camel springboot app 连接到 bonsai kafka clustur。
Below is my config (password changed)以下是我的配置(密码已更改)
camel.component.kafka.brokers=https://321312:213213@camel-4054112539.us-east-1.bonsaisearch.net:443
camel.component.kafka.security-protocol=SSL
camel.component.kafka.ssl-truststore-location=C:/Users/meow/tools/jdk1.8.0_291/jre/lib/security/cacerts
camel.component.kafka.ssl-truststore-password=changeit
Below is producer下面是制作人
public class ActiveSenderRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:kafka-timer?period=5000").bean(MessageCreater.class).to("kafka:mytopic");
}
}
@Component
class MessageCreater {
int i = 0;
public void createMessage(Exchange ex) {
String message = "my message " + (++i);
System.out.println("writing to log");
ex.getIn().setBody(message);
}
}
I am getting below error , the first line contiues for long and then getting log from second line我遇到错误,第一行持续很长时间,然后从第二行获取日志
2021-06-24 16:27:01.367 WARN 13456 --- [ad |
2021-06-24 16:27:01.367 警告 13456 --- [广告 | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Bootstrap broker camel-4054112539.us-east-1.bonsaisearch.net:443 (id: -1 rack: null) disconnected
producer-1] org.apache.kafka.clients.NetworkClient :[Producer clientId=producer-1] Bootstrap broker camel-4054112539.us-east-1.bonsaisearch.net:443 (id: -1 rack: null) 断开连接
2021-06-24 16:35:07.997 WARN 9112 --- [ad |
2021-06-24 16:35:07.997 警告 9112 --- [广告 | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Bootstrap broker camel-4054112539.us-east-1.bonsaisearch.net:443 (id: -1 rack: null) disconnected 2021-06-24 16:35:08.163 ERROR 9112 --- [r://kafka-timer] oacpeDefaultErrorHandler : Failed delivery for (MessageId: 4ACC1A23B54E627-0000000000000000 on ExchangeId: 4ACC1A23B54E627-0000000000000000).
producer-1] org.apache.kafka.clients.NetworkClient :[Producer clientId=producer-1] Bootstrap broker camel-4054112539.us-east-1.bonsaisearch.net:443 (id: -1 rack: null) 断开连接 2021 -06-24 16:35:08.163 错误 9112 --- [r://kafka-timer] oacpeDefaultErrorHandler:传递失败(MessageId:4ACC1A23B54E627-0000000000000000 on ExchangeId:4540000200000000000)。0 Exhausted after delivery attempt: 1 caught: org.apache.kafka.common.errors.TimeoutException: Topic mytopic not present in metadata after 60000 ms.
传递尝试后耗尽:1 捕获:org.apache.kafka.common.errors.TimeoutException:60000 毫秒后元数据中不存在主题 mytopic。
Message History (complete message history is disabled) --------------------------------------------------------------------------------------------------------------------------------------- RouteId ProcessorId Processor
消息历史(禁用完整的消息历史)----------------------------------------- -------------------------------------------------- -------------------------------------------- RouteId ProcessorId 处理器
Elapsed (ms) [route1 ] [route1 ] [from[timer://kafka-timer?period=5000]已用时间 (ms) [route1 ] [route1 ] [from[timer://kafka-timer?period=5000]
] [ 60054] ... [route1 ] [to1 ] [kafka:mytopic] [ 60054] ... [route1 ] [to1 ] [kafka:mytopic
] [ 0]] [ 0]
Stacktrace
堆栈跟踪
org.apache.kafka.common.errors.TimeoutException: Topic mytopic not present in metadata after 60000 ms.
org.apache.kafka.common.errors.TimeoutException:60000 毫秒后元数据中不存在主题 mytopic。
2021-06-24 16:35:08.167 WARN 9112 --- [r://kafka-timer] oacamel.component.timer.TimerConsumer : Error processing exchange.
2021-06-24 16:35:08.167 WARN 9112 --- [r://kafka-timer] oacamel.component.timer.TimerConsumer:处理交换时出错。 Exchange[4ACC1A23B54E627-0000000000000000].
交换[4ACC1A23B54E627-0000000000000000]。 Caused by: [org.apache.kafka.common.errors.TimeoutException - Topic mytopic not present in metadata after 60000 ms.]
引起:[org.apache.kafka.common.errors.TimeoutException - 60000 毫秒后元数据中不存在主题 mytopic。]
org.apache.kafka.common.errors.TimeoutException: Topic mytopic not present in metadata after 60000 ms.
org.apache.kafka.common.errors.TimeoutException:60000 毫秒后元数据中不存在主题 mytopic。
好像你的kafka broker上没有开启自动创建topic,所以需要先创建mytopic然后运行路由,或者开启自动创建topic。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.