2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package com.att.nsa.cambria.embed;
\r
23 import java.io.IOException;
\r
24 import java.util.Properties;
\r
26 import kafka.server.KafkaConfig;
\r
27 import kafka.server.KafkaServerStartable;
\r
30 public class KafkaLocal {
\r
32 public KafkaServerStartable kafka;
\r
33 public ZooKeeperLocal zookeeper;
\r
35 public KafkaLocal(Properties kafkaProperties, Properties zkProperties) throws IOException, InterruptedException{
\r
36 KafkaConfig kafkaConfig = new KafkaConfig(kafkaProperties);
\r
38 //start local zookeeper
\r
39 System.out.println("starting local zookeeper...");
\r
40 zookeeper = new ZooKeeperLocal(zkProperties);
\r
41 System.out.println("done");
\r
43 //start local kafka broker
\r
44 kafka = new KafkaServerStartable(kafkaConfig);
\r
45 System.out.println("starting local kafka broker...");
\r
47 System.out.println("done");
\r
53 System.out.println("stopping kafka...");
\r
55 System.out.println("done");
\r