Search in sources :

Example 26 with KafkaServerStartable

use of kafka.server.KafkaServerStartable in project pinpoint by naver.

the class KafkaUnitServer method startup.

public void startup() {
    zookeeper = new ZookeeperUnitServer(zkPort, zkMaxConnections);
    zookeeper.startup();
    try {
        logDir = Files.createTempDirectory("kafka").toFile();
    } catch (IOException e) {
        throw new RuntimeException("Unable to start Kafka", e);
    }
    logDir.deleteOnExit();
    Runtime.getRuntime().addShutdownHook(new Thread(getDeleteLogDirectoryAction()));
    kafkaBrokerConfig.setProperty("zookeeper.connect", zookeeperString);
    kafkaBrokerConfig.setProperty("broker.id", "1");
    kafkaBrokerConfig.setProperty("host.name", "localhost");
    kafkaBrokerConfig.setProperty("port", Integer.toString(brokerPort));
    kafkaBrokerConfig.setProperty("log.dir", logDir.getAbsolutePath());
    kafkaBrokerConfig.setProperty("log.flush.interval.messages", String.valueOf(1));
    kafkaBrokerConfig.setProperty("delete.topic.enable", String.valueOf(true));
    kafkaBrokerConfig.setProperty("offsets.topic.replication.factor", String.valueOf(1));
    kafkaBrokerConfig.setProperty("auto.create.topics.enable", String.valueOf(true));
    broker = new KafkaServerStartable(new KafkaConfig(kafkaBrokerConfig));
    broker.startup();
}
Also used : KafkaServerStartable(kafka.server.KafkaServerStartable) IOException(java.io.IOException) KafkaConfig(kafka.server.KafkaConfig)

Example 27 with KafkaServerStartable

use of kafka.server.KafkaServerStartable in project beam by apache.

the class EmbeddedKafkaCluster method startBroker.

private static KafkaServerStartable startBroker(Properties props) {
    KafkaServerStartable server = new KafkaServerStartable(new KafkaConfig(props));
    server.startup();
    return server;
}
Also used : KafkaServerStartable(kafka.server.KafkaServerStartable) KafkaConfig(kafka.server.KafkaConfig)

Aggregations

KafkaServerStartable (kafka.server.KafkaServerStartable)27 KafkaConfig (kafka.server.KafkaConfig)21 Properties (java.util.Properties)17 File (java.io.File)15 TestingServer (org.apache.curator.test.TestingServer)12 ServerSocket (java.net.ServerSocket)11 ZkClient (org.I0Itec.zkclient.ZkClient)8 ZkUtils (kafka.utils.ZkUtils)7 ZkConnection (org.I0Itec.zkclient.ZkConnection)7 Path (java.nio.file.Path)4 HashMap (java.util.HashMap)4 InstanceSpec (org.apache.curator.test.InstanceSpec)4 OfflineClusterIntegrationTest (com.linkedin.pinot.integration.tests.OfflineClusterIntegrationTest)2 FileOutputStream (java.io.FileOutputStream)2 OutputStream (java.io.OutputStream)2 KeyStore (java.security.KeyStore)2 ArrayList (java.util.ArrayList)2 JSONArray (org.json.JSONArray)2 JSONObject (org.json.JSONObject)2 EmbeddedZookeeper.getResourceAsProperties (com.googlecode.jmxtrans.model.output.kafka.EmbeddedZookeeper.getResourceAsProperties)1