Şu satırı dahil ederiz
import org.springframework.kafka.core.KafkaAdmin;
Şöyle yaparız
@Configuration public class KafkaProducerConfig { ... @Value("${kafka.bootstrap-servers}") private String bootstrapServers; @Bean public KafkaAdmin admin() { LOGGER.info("{} = {}", AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); Map<String, Object> configs = new HashMap<>(); configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); KafkaAdmin kafkaAdmin = new KafkaAdmin(configs); kafkaAdmin.setFatalIfBrokerNotAvailable(true); kafkaAdmin.setBootstrapServersSupplier(() -> bootstrapServers); return kafkaAdmin; } }
Hiç yorum yok:
Yorum Gönder