Java Code Examples for kafka.server.KafkaServerStartable#startup()
The following examples show how to use
kafka.server.KafkaServerStartable#startup() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KafkaUnit.java From SkaETL with Apache License 2.0 | 6 votes |
public void startup() { zookeeper = new Zookeeper(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(false)); broker = new KafkaServerStartable(new KafkaConfig(kafkaBrokerConfig)); broker.startup(); }
Example 2
Source File: KafkaTestUtil.java From siddhi-io-kafka with Apache License 2.0 | 6 votes |
public static void setupKafkaBroker() { try { log.info("#############################################################################################"); log.info("################################# ZOOKEEPER STARTED ######################################"); log.info("#############################################################################################"); // mock zookeeper zkTestServer = new TestingServer(2181); // mock kafka Properties props = new Properties(); props.put("broker.id", "0"); props.put("host.name", "localhost"); props.put("port", "9092"); props.put("log.dir", kafkaLogDir); props.put("zookeeper.connect", zkTestServer.getConnectString()); props.put("replica.socket.timeout.ms", "30000"); props.put("delete.topic.enable", "true"); props.put("log.cleaner.dedupe.buffer.size", CLEANER_BUFFER_SIZE); KafkaConfig config = new KafkaConfig(props); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); } catch (Exception e) { log.error("Error running local Kafka broker / Zookeeper", e); } }
Example 3
Source File: KafkaTestUtil.java From siddhi-io-kafka with Apache License 2.0 | 6 votes |
public static void setupKafkaBroker2() { try { log.info("#############################################################################################"); log.info("################################# ZOOKEEPER 2 STARTED ####################################"); log.info("#############################################################################################"); // mock zookeeper zkTestServer2 = new TestingServer(2182); // mock kafka Properties props = new Properties(); props.put("broker.id", "1"); props.put("host.name", "localhost"); props.put("port", "9093"); props.put("log.dir", kafkaLogDir2); props.put("zookeeper.connect", zkTestServer2.getConnectString()); props.put("replica.socket.timeout.ms", "30000"); props.put("delete.topic.enable", "true"); props.put("log.cleaner.dedupe.buffer.size", CLEANER_BUFFER_SIZE); KafkaConfig config = new KafkaConfig(props); kafkaServer2 = new KafkaServerStartable(config); kafkaServer2.startup(); } catch (Exception e) { log.error("Error running local Kafka broker 2", e); } }
Example 4
Source File: KafkaStarterUtils.java From uReplicator with Apache License 2.0 | 6 votes |
public static KafkaServerStartable startServer(final int port, final int brokerId, final String zkStr, final Properties configuration) { // Create the ZK nodes for Kafka, if needed int indexOfFirstSlash = zkStr.indexOf('/'); if (indexOfFirstSlash != -1) { String bareZkUrl = zkStr.substring(0, indexOfFirstSlash); String zkNodePath = zkStr.substring(indexOfFirstSlash); ZkClient client = new ZkClient(bareZkUrl); client.createPersistent(zkNodePath, true); client.close(); } File logDir = new File("/tmp/kafka-" + Double.toHexString(Math.random())); logDir.mkdirs(); logDir.deleteOnExit(); kafkaDataDir = logDir.toString(); configureKafkaPort(configuration, port); configureZkConnectionString(configuration, zkStr); configureBrokerId(configuration, brokerId); configureKafkaLogDirectory(configuration, logDir); KafkaConfig config = new KafkaConfig(configuration); KafkaServerStartable serverStartable = new KafkaServerStartable(config); serverStartable.startup(); return serverStartable; }
Example 5
Source File: LocalKafkaServer.java From Krackle with Apache License 2.0 | 6 votes |
public LocalKafkaServer() throws IOException { while (new File(logDir).exists()) { FileUtils.deleteDirectory(new File(logDir)); } Properties props = new Properties(); props.put("broker.id", nodeId); props.put("port", port); props.put("log.dir", logDir); props.put("zookeeper.connect", zkConnect); props.put("host.name", "127.0.0.1"); KafkaConfig conf = new KafkaConfig(props); zkUtils = ZkUtils.apply(props.getProperty("zookeeper.connect"), 30000, 30000, JaasUtils.isZkSecurityEnabled()); server = new KafkaServerStartable(conf); server.startup(); }
Example 6
Source File: LocalKafkaBroker.java From oryx with Apache License 2.0 | 6 votes |
/** * Starts the Kafka broker. * * @throws IOException if an error occurs during initialization */ public synchronized void start() throws IOException { log.info("Starting Kafka broker on port {}", port); logsDir = Files.createTempDirectory(LocalKafkaBroker.class.getSimpleName()); logsDir.toFile().deleteOnExit(); kafkaServer = new KafkaServerStartable(new KafkaConfig(ConfigUtils.keyValueToProperties( "broker.id", TEST_BROKER_ID, "log.dirs", logsDir.toAbsolutePath(), "listeners", "PLAINTEXT://:" + port, "zookeeper.connect", "localhost:" + zkPort, "message.max.bytes", 1 << 26, "replica.fetch.max.bytes", 1 << 26, "offsets.topic.replication.factor", 1 ), false)); kafkaServer.startup(); }
Example 7
Source File: KafkaTestServerImpl.java From eagle with Apache License 2.0 | 6 votes |
@Override public void start() throws Exception { zkServer = new TestingServer(zookeeperPort, logDir); ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 3); curatorClient = CuratorFrameworkFactory.newClient(zkServer.getConnectString(), retryPolicy); curatorClient.start(); Properties props = new Properties(); props.setProperty("zookeeper.connect", zkServer.getConnectString()); props.setProperty("broker.id", "0"); props.setProperty("port", "" + kafkaPort); props.setProperty("log.dirs", logDir.getAbsolutePath()); props.setProperty("auto.create.topics.enable", "true"); kafkaServer = new KafkaServerStartable(new KafkaConfig(props)); kafkaServer.startup(); }
Example 8
Source File: KafkaEmbedded.java From eagle with Apache License 2.0 | 6 votes |
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); } }
Example 9
Source File: KafkaTestCase.java From product-cep with Apache License 2.0 | 6 votes |
private void setupKafkaBroker() { try { // mock zookeeper zkTestServer = new TestingServer(2181); // mock kafka Properties props = new Properties(); props.put("broker.id", "0"); props.put("host.name", "localhost"); props.put("port", "9092"); props.put("log.dir", "/tmp/tmp_kafka_dir"); props.put("zookeeper.connect", zkTestServer.getConnectString()); props.put("replica.socket.timeout.ms", "1500"); KafkaConfig config = new KafkaConfig(props); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); // create "sensordata" topic ZkClient zkClient = new ZkClient(zkTestServer.getConnectString(), 10000, 10000, ZKStringSerializer$.MODULE$); AdminUtils.createTopic(zkClient, "sensordata", 1, 1, new Properties()); zkClient.close(); } catch (Exception e) { log.error("Error running local Kafka broker / Zookeeper", e); } }
Example 10
Source File: EmbeddedKafka.java From mercury with Apache License 2.0 | 5 votes |
@Override public void run() { try (InputStream stream = EmbeddedKafka.class.getResourceAsStream("/kafka.properties")) { if (stream == null) { throw new IOException("kafka.properties is not available as resource"); } Properties p = new Properties(); p.load(stream); String dir = p.getProperty("log.dirs"); if (dir != null) { File reset = new File(dir); if (reset.exists() && reset.isDirectory()) { Utility.getInstance().cleanupDir(reset); log.info("Clean up transient Kafka working directory at {}", dir); } } kafka = new KafkaServerStartable(new KafkaConfig(p)); kafka.startup(); Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown)); } catch (IOException e) { log.error("Unable to start Kafka kafka - {}", e.getMessage()); System.exit(-1); } }
Example 11
Source File: KafkaServer.java From ingestion with Apache License 2.0 | 5 votes |
public void start() throws Exception { File dir = Files.createTempDir(); String dirPath = dir.getAbsolutePath(); System.out.println("Storing Kafka files in " + dirPath); String localhostKafka = System.getProperty("kafka.ip"); String localhostZookeeper = System.getProperty("zookeeper.ip"); String portKafka = System.getProperty("kafka.port"); String portZookeeper = System.getProperty("zookeeper.port"); Properties properties = new Properties(); properties.put("broker.id", "0"); properties.put("host.name", "localhost"); // properties.put("host.name", localhostKafka); properties.put("port", KAFKA_PORT); properties.put("log.dir", dirPath); properties.put("log.flush.interval.messages", "1"); // properties.put("zookeeper.connect", "localhost:" + ZookeeperServer.CLIENT_PORT); properties.put("zookeeper.connect", localhostZookeeper+":" + ZookeeperServer.CLIENT_PORT); // properties.put("zookeeper.connect", "port:" + ZookeeperServer.CLIENT_PORT); // Integer clientPort = Integer.parseInt(System.getProperty("zookeeper.port")); // properties.put("zookeeper.connect", "localhost:" + clientPort); properties.put("replica.socket.timeout.ms", "1500"); properties.put("auto.create.topics.enable", "true"); properties.put("num.partitions", "1"); KafkaConfig kafkaConfig = new KafkaConfig(properties); kafkaServer = new KafkaServerStartable(kafkaConfig); kafkaServer.startup(); TimeUnit.SECONDS.sleep(WAIT_SECONDS); }
Example 12
Source File: KafkaServer.java From hbase-connect-kafka with Apache License 2.0 | 5 votes |
public KafkaServer(int zookeeperPort, int kafkaBrokerPort) { try { Preconditions.checkArgument(zookeeperPort > 0); Preconditions.checkArgument(kafkaBrokerPort > 0); this.zookeeperPort = zookeeperPort; this.brokerPort = kafkaBrokerPort; this.logDir = new File(System.getProperty("java.io.tmpdir"), "kafka/logs/hbase-cdc-kafka-" + brokerPort); KafkaConfig config = buildKafkaConfig(zookeeperPort); kafka = new KafkaServerStartable(config); kafka.startup(); } catch (Exception ex) { throw new RuntimeException("Could not start test broker", ex); } }
Example 13
Source File: KafkaDemoClient.java From iotplatform with Apache License 2.0 | 5 votes |
private static void startKafkaLocal() throws Exception { final File kafkaTmpLogsDir = File.createTempFile("zookeeper", "test"); if (kafkaTmpLogsDir.delete() && kafkaTmpLogsDir.mkdir()) { Properties kafkaProperties = new Properties(); kafkaProperties.setProperty("host.name", HOSTNAME); kafkaProperties.setProperty("port", String.valueOf(KAFKA_PORT)); kafkaProperties.setProperty("broker.id", String.valueOf(BROKER_ID)); kafkaProperties.setProperty("zookeeper.connect", ZOOKEEPER_CONNECT); kafkaProperties.setProperty("log.dirs", kafkaTmpLogsDir.getAbsolutePath()); KafkaConfig kafkaConfig = new KafkaConfig(kafkaProperties); KafkaServerStartable kafka = new KafkaServerStartable(kafkaConfig); kafka.startup(); } }
Example 14
Source File: KafkaRangerAuthorizerSASLSSLTest.java From ranger with Apache License 2.0 | 4 votes |
@org.junit.BeforeClass public static void setup() throws Exception { // JAAS Config file String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = new File(".").getCanonicalPath(); } File f = new File(basedir + "/src/test/resources/kafka_plain.jaas"); System.setProperty("java.security.auth.login.config", f.getPath()); // Create keys String serviceDN = "CN=Service,O=Apache,L=Dublin,ST=Leinster,C=IE"; String clientDN = "CN=Client,O=Apache,L=Dublin,ST=Leinster,C=IE"; // Create a truststore KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(null, "security".toCharArray()); serviceKeystorePath = KafkaTestUtils.createAndStoreKey(serviceDN, serviceDN, BigInteger.valueOf(30), "sspass", "myservicekey", "skpass", keystore); clientKeystorePath = KafkaTestUtils.createAndStoreKey(clientDN, clientDN, BigInteger.valueOf(31), "cspass", "myclientkey", "ckpass", keystore); File truststoreFile = File.createTempFile("kafkatruststore", ".jks"); try (OutputStream output = new FileOutputStream(truststoreFile)) { keystore.store(output, "security".toCharArray()); } truststorePath = truststoreFile.getPath(); zkServer = new TestingServer(); // Get a random port ServerSocket serverSocket = new ServerSocket(0); port = serverSocket.getLocalPort(); serverSocket.close(); final Properties props = new Properties(); props.put("broker.id", 1); props.put("host.name", "localhost"); props.put("port", port); props.put("log.dir", "/tmp/kafka"); props.put("zookeeper.connect", zkServer.getConnectString()); props.put("replica.socket.timeout.ms", "1500"); props.put("controlled.shutdown.enable", Boolean.TRUE.toString()); // Enable SASL_SSL props.put("listeners", "SASL_SSL://localhost:" + port); props.put("security.inter.broker.protocol", "SASL_SSL"); props.put("sasl.enabled.mechanisms", "PLAIN"); props.put("sasl.mechanism.inter.broker.protocol", "PLAIN"); props.put("offsets.topic.replication.factor", (short) 1); props.put("offsets.topic.num.partitions", 1); props.put("ssl.keystore.location", serviceKeystorePath); props.put("ssl.keystore.password", "sspass"); props.put("ssl.key.password", "skpass"); props.put("ssl.truststore.location", truststorePath); props.put("ssl.truststore.password", "security"); // Plug in Apache Ranger authorizer props.put("authorizer.class.name", "org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer"); // Create users for testing UserGroupInformation.createUserForTesting("alice", new String[] {"IT"}); KafkaConfig config = new KafkaConfig(props); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); // Create some topics KafkaTestUtils.createSomeTopics(zkServer.getConnectString()); }
Example 15
Source File: KafkaRangerTopicCreationTest.java From ranger with Apache License 2.0 | 4 votes |
@org.junit.BeforeClass public static void setup() throws Exception { String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = new File(".").getCanonicalPath(); } System.out.println("Base Dir " + basedir); configureKerby(basedir); // JAAS Config file - We need to point to the correct keytab files Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/kafka_kerberos.jaas"); String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); content = content.replaceAll("<basedir>", basedir); //content = content.replaceAll("zookeeper/localhost", "zookeeper/" + address); Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/kafka_kerberos.jaas"); Files.write(path2, content.getBytes(StandardCharsets.UTF_8)); System.setProperty("java.security.auth.login.config", path2.toString()); // Set up Zookeeper to require SASL Map<String,Object> zookeeperProperties = new HashMap<>(); zookeeperProperties.put("authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); zookeeperProperties.put("requireClientAuthScheme", "sasl"); zookeeperProperties.put("jaasLoginRenew", "3600000"); InstanceSpec instanceSpec = new InstanceSpec(null, -1, -1, -1, true, 1,-1, -1, zookeeperProperties, "localhost"); zkServer = new TestingServer(instanceSpec, true); // Get a random port ServerSocket serverSocket = new ServerSocket(0); port = serverSocket.getLocalPort(); serverSocket.close(); tempDir = Files.createTempDirectory("kafka"); LOG.info("Port is {}", port); LOG.info("Temporary directory is at {}", tempDir); final Properties props = new Properties(); props.put("broker.id", 1); props.put("host.name", "localhost"); props.put("port", port); props.put("log.dir", tempDir.toString()); props.put("zookeeper.connect", zkServer.getConnectString()); props.put("replica.socket.timeout.ms", "1500"); props.put("controlled.shutdown.enable", Boolean.TRUE.toString()); // Enable SASL_PLAINTEXT props.put("listeners", "SASL_PLAINTEXT://localhost:" + port); props.put("security.inter.broker.protocol", "SASL_PLAINTEXT"); props.put("sasl.enabled.mechanisms", "GSSAPI"); props.put("sasl.mechanism.inter.broker.protocol", "GSSAPI"); props.put("sasl.kerberos.service.name", "kafka"); props.put("offsets.topic.replication.factor", (short) 1); props.put("offsets.topic.num.partitions", 1); // Plug in Apache Ranger authorizer props.put("authorizer.class.name", "org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer"); // Create users for testing UserGroupInformation.createUserForTesting("[email protected]", new String[] {"public"}); UserGroupInformation.createUserForTesting("kafka/[email protected]", new String[] {"IT"}); KafkaConfig config = new KafkaConfig(props); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); }
Example 16
Source File: KafkaRangerAuthorizerGSSTest.java From ranger with Apache License 2.0 | 4 votes |
@org.junit.BeforeClass public static void setup() throws Exception { String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = new File(".").getCanonicalPath(); } configureKerby(basedir); // JAAS Config file - We need to point to the correct keytab files Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/kafka_kerberos.jaas"); String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); content = content.replaceAll("<basedir>", basedir); //content = content.replaceAll("zookeeper/localhost", "zookeeper/" + address); Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/kafka_kerberos.jaas"); Files.write(path2, content.getBytes(StandardCharsets.UTF_8)); System.setProperty("java.security.auth.login.config", path2.toString()); // Set up Zookeeper to require SASL Map<String,Object> zookeeperProperties = new HashMap<>(); zookeeperProperties.put("authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); zookeeperProperties.put("requireClientAuthScheme", "sasl"); zookeeperProperties.put("jaasLoginRenew", "3600000"); InstanceSpec instanceSpec = new InstanceSpec(null, -1, -1, -1, true, 1,-1, -1, zookeeperProperties, "localhost"); zkServer = new TestingServer(instanceSpec, true); // Get a random port ServerSocket serverSocket = new ServerSocket(0); port = serverSocket.getLocalPort(); serverSocket.close(); tempDir = Files.createTempDirectory("kafka"); LOG.info("Port is {}", port); LOG.info("Temporary directory is at {}", tempDir); final Properties props = new Properties(); props.put("broker.id", 1); props.put("host.name", "localhost"); props.put("port", port); props.put("log.dir", tempDir.toString()); props.put("zookeeper.connect", zkServer.getConnectString()); props.put("replica.socket.timeout.ms", "1500"); props.put("controlled.shutdown.enable", Boolean.TRUE.toString()); // Enable SASL_PLAINTEXT props.put("listeners", "SASL_PLAINTEXT://localhost:" + port); props.put("security.inter.broker.protocol", "SASL_PLAINTEXT"); props.put("sasl.enabled.mechanisms", "GSSAPI"); props.put("sasl.mechanism.inter.broker.protocol", "GSSAPI"); props.put("sasl.kerberos.service.name", "kafka"); props.put("offsets.topic.replication.factor", (short) 1); props.put("offsets.topic.num.partitions", 1); // Plug in Apache Ranger authorizer props.put("authorizer.class.name", "org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer"); // Create users for testing UserGroupInformation.createUserForTesting("[email protected]", new String[] {"public"}); UserGroupInformation.createUserForTesting("kafka/[email protected]", new String[] {"IT"}); KafkaConfig config = new KafkaConfig(props); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); // Create some topics KafkaTestUtils.createSomeTopics(zkServer.getConnectString()); }
Example 17
Source File: KafkaRangerAuthorizerTest.java From ranger with Apache License 2.0 | 4 votes |
@org.junit.BeforeClass public static void setup() throws Exception { // Create keys String serviceDN = "CN=localhost,O=Apache,L=Dublin,ST=Leinster,C=IE"; String clientDN = "CN=localhost,O=Apache,L=Dublin,ST=Leinster,C=IE"; // Create a truststore KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(null, "security".toCharArray()); serviceKeystorePath = KafkaTestUtils.createAndStoreKey(serviceDN, serviceDN, BigInteger.valueOf(30), "sspass", "myservicekey", "skpass", keystore); clientKeystorePath = KafkaTestUtils.createAndStoreKey(clientDN, clientDN, BigInteger.valueOf(31), "cspass", "myclientkey", "ckpass", keystore); File truststoreFile = File.createTempFile("kafkatruststore", ".jks"); try (OutputStream output = new FileOutputStream(truststoreFile)) { keystore.store(output, "security".toCharArray()); } truststorePath = truststoreFile.getPath(); zkServer = new TestingServer(); // Get a random port ServerSocket serverSocket = new ServerSocket(0); port = serverSocket.getLocalPort(); serverSocket.close(); tempDir = Files.createTempDirectory("kafka"); final Properties props = new Properties(); props.put("broker.id", 1); props.put("host.name", "localhost"); props.put("port", port); props.put("log.dir", tempDir.toString()); props.put("zookeeper.connect", zkServer.getConnectString()); props.put("replica.socket.timeout.ms", "1500"); props.put("controlled.shutdown.enable", Boolean.TRUE.toString()); // Enable SSL props.put("listeners", "SSL://localhost:" + port); props.put("ssl.keystore.location", serviceKeystorePath); props.put("ssl.keystore.password", "sspass"); props.put("ssl.key.password", "skpass"); props.put("ssl.truststore.location", truststorePath); props.put("ssl.truststore.password", "security"); props.put("security.inter.broker.protocol", "SSL"); props.put("ssl.client.auth", "required"); props.put("offsets.topic.replication.factor", (short) 1); props.put("offsets.topic.num.partitions", 1); // Plug in Apache Ranger authorizer props.put("authorizer.class.name", "org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer"); // Create users for testing UserGroupInformation.createUserForTesting(clientDN, new String[] {"public"}); UserGroupInformation.createUserForTesting(serviceDN, new String[] {"IT"}); KafkaConfig config = new KafkaConfig(props); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); // Create some topics KafkaTestUtils.createSomeTopics(zkServer.getConnectString()); }
Example 18
Source File: EmbeddedKafkaCluster.java From beam with Apache License 2.0 | 4 votes |
private static KafkaServerStartable startBroker(Properties props) { KafkaServerStartable server = new KafkaServerStartable(new KafkaConfig(props)); server.startup(); return server; }
Example 19
Source File: TestKafkaCluster.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
public TestKafkaCluster(String connectString, String offsetsTopicReplicationFactor) { KafkaConfig config = getKafkaConfig(connectString, offsetsTopicReplicationFactor); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); }