Reputation: 1363
I am trying to connect to bonsai kafka clustur from apche camel springboot app .
Below is my config (password changed)
camel.component.kafka.brokers=https://321312:[email protected]: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 | 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:07.997 WARN 9112 --- [ad | 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] o.a.c.p.e.DefaultErrorHandler : Failed delivery for (MessageId: 4ACC1A23B54E627-0000000000000000 on ExchangeId: 4ACC1A23B54E627-0000000000000000). Exhausted after delivery attempt: 1 caught: org.apache.kafka.common.errors.TimeoutException: Topic mytopic not present in metadata after 60000 ms.
Message History (complete message history is disabled) --------------------------------------------------------------------------------------------------------------------------------------- RouteId ProcessorId Processor
Elapsed (ms) [route1 ] [route1 ] [from[timer://kafka-timer?period=5000]
] [ 60054] ... [route1 ] [to1 ] [kafka:mytopic
] [ 0]Stacktrace
org.apache.kafka.common.errors.TimeoutException: Topic mytopic not present in metadata after 60000 ms.
2021-06-24 16:35:08.167 WARN 9112 --- [r://kafka-timer] o.a.camel.component.timer.TimerConsumer : Error processing exchange. Exchange[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: Topic mytopic not present in metadata after 60000 ms.
Upvotes: 0
Views: 254
Reputation: 1656
It seems on your kafka broker the automatic creation of topic is not enabled, so you need to create mytopic topic first and then run the route, or enabling the automatic creation of topic.
Upvotes: 0