public String getZkConnectionString() { return zk.getConnectionString(); }
public KafkaEmbedded(Integer kafkaPort, Integer zookeeperPort) { try { zk = new ZookeeperEmbedded(zookeeperPort); zk.start(); this.port = null != kafkaPort ? kafkaPort : InstanceSpec.getRandomPort(); logDir = new File(System.getProperty("java.io.tmpdir"), "kafka/logs/kafka-test-" + kafkaPort); FileUtils.deleteQuietly(logDir); KafkaConfig config = buildKafkaConfig(zk.getConnectionString()); kafka = new KafkaServerStartable(config); kafka.startup(); } catch (Exception ex) { throw new RuntimeException("Could not start test broker", ex); } }