use of org.I0Itec.zkclient.ZkClient in project metron by apache.
the class KafkaComponent method start.
@Override
public void start() {
// setup Zookeeper
zookeeperConnectString = topologyProperties.getProperty(ZKServerComponent.ZOOKEEPER_PROPERTY);
zkClient = new ZkClient(zookeeperConnectString, 30000, 30000, ZKStringSerializer$.MODULE$);
// setup Broker
Properties props = TestUtilsWrapper.createBrokerConfig(0, zookeeperConnectString, brokerPort);
props.setProperty("zookeeper.connection.timeout.ms", "1000000");
KafkaConfig config = new KafkaConfig(props);
Time mock = new MockTime();
kafkaServer = TestUtils.createServer(config, mock);
org.apache.log4j.Level oldLevel = UnitTestHelper.getLog4jLevel(KafkaServer.class);
UnitTestHelper.setLog4jLevel(KafkaServer.class, org.apache.log4j.Level.OFF);
// do not proceed until the broker is up
TestUtilsWrapper.waitUntilBrokerIsRunning(kafkaServer, "Timed out waiting for RunningAsBroker State", 100000);
for (Topic topic : getTopics()) {
try {
createTopic(topic.name, topic.numPartitions, true);
} catch (InterruptedException e) {
throw new RuntimeException("Unable to create topic", e);
}
}
UnitTestHelper.setLog4jLevel(KafkaServer.class, oldLevel);
if (postStartCallback != null) {
postStartCallback.apply(this);
}
}
Aggregations