I have a Spring boot project that has dependencies that use kafka for logging. I can't get rid of said dependency because my logic requires code from that dependency
I want to start said application locally without running kafka so I can test my simple db lookup code.
I've tried disabling autoconfiguration
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration
I've tried setting missingTopicsFatal to false via bean configuration
@Bean(name = "kafkaListenerContainerFactory")
public ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory(
ConsumerFactory<Object, Object> kafkaConsumerFactor,
ConcurrentKafkaListenerContainerFactoryConfigurer configurer) {
ConcurrentKafkaListenerContainerFactory<Object, Object> factory =
new ConcurrentKafkaListenerContainerFactory<>();
configurer.configure(factory, kafkaConsumerFactor);
ContainerProperties containerProperties = factory.getContainerProperties();
containerProperties.setMissingTopicsFatal(false);
...
return factory;
}
But evidently the setting is already false as my application runs without failing, just that tomcat doesn't want to open the listen port
All other solutions I've encountered involves changing the code where kafka is used; in this case, the dependency I am using. But I have no access to changing said dependency.
The application starts but spring refuses to open a listen port and keeps looping with the error
Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
The application runs fine with kafka running locally except now the mere act of typing is slow thanks to kafka's resource usage. Please help.