[Solved] java.lang.IllegalArgumentException: Topic cannot be null.
Exception:
java.lang.IllegalArgumentException: Topic cannot be null.
Make sure you have your kafka topic created.
Solution:
Add below code to create Kafka topic automatically when not exist,
Here ngdev-topic is the kafka topic name.
Partitions and replicas are additional configurations, add/configure as per your wish.
package com.ngdeveloper.ngdeveloperkafkaproducer.config;
import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.TopicBuilder;
@Configuration
public class AutoCreateConfig {
@Bean
public NewTopic createNgDevTopic() {
return TopicBuilder.name("ngdev-topic").partitions(3).replicas(3).build();
}
}
Joining the ClubPK was the best decision I made this week! Good community and solid games. Join the fun clubpk.
The energy on this site is awesome. The games are exciting and the promotions are always updated. Go to phfierylogin
Finally found a site that actually works smoothly. The login process is super fast and I didn’t encounter any lags while playing. Highly recommend jiliglorylogin for anyone looking for a reliable platform.
Finally found a site that actually works smoothly. The login process is super fast and I didn’t encounter any lags while playing. Highly recommend jiliglorylogin for anyone looking for a reliable platform.
Finally found a site that actually works smoothly. The login process is super fast and I didn’t encounter any lags while playing. Highly recommend jiliglorylogin for anyone looking for a reliable platform.