use of kafka.server.KafkaServer in project incubator-atlas by apache.
the class KafkaNotification method startKafka.
private void startKafka() throws IOException, URISyntaxException {
String kafkaValue = properties.getProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG);
LOG.debug("Starting kafka at {}", kafkaValue);
URL kafkaAddress = getURL(kafkaValue);
Properties brokerConfig = properties;
brokerConfig.setProperty("broker.id", "1");
brokerConfig.setProperty("host.name", kafkaAddress.getHost());
brokerConfig.setProperty("port", String.valueOf(kafkaAddress.getPort()));
brokerConfig.setProperty("log.dirs", constructDir("kafka").getAbsolutePath());
brokerConfig.setProperty("log.flush.interval.messages", String.valueOf(1));
kafkaServer = new KafkaServer(KafkaConfig.fromProps(brokerConfig), new SystemTime(), Option.apply(this.getClass().getName()));
kafkaServer.startup();
LOG.debug("Embedded kafka server started with broker config {}", brokerConfig);
}
use of kafka.server.KafkaServer in project druid by druid-io.
the class TestBroker method start.
public void start() {
final Properties props = new Properties();
props.setProperty("zookeeper.connect", zookeeperConnect);
props.setProperty("zookeeper.session.timeout.ms", "30000");
props.setProperty("zookeeper.connection.timeout.ms", "30000");
props.setProperty("log.dirs", directory.toString());
props.setProperty("broker.id", String.valueOf(id));
props.setProperty("port", String.valueOf(ThreadLocalRandom.current().nextInt(9999) + 10000));
props.setProperty("advertised.host.name", "localhost");
props.setProperty("transaction.state.log.replication.factor", "1");
props.setProperty("offsets.topic.replication.factor", "1");
props.setProperty("transaction.state.log.min.isr", "1");
props.putAll(brokerProps);
final KafkaConfig config = new KafkaConfig(props);
server = new KafkaServer(config, Time.SYSTEM, Some.apply(StringUtils.format("TestingBroker[%d]-", id)), false);
server.startup();
}
use of kafka.server.KafkaServer in project apex-malhar by apache.
the class EmbeddedKafka method createTopic.
public void createTopic(String topic) {
AdminUtils.createTopic(zkUtils, topic, 1, 1, new Properties());
List<KafkaServer> servers = new ArrayList<KafkaServer>();
servers.add(kafkaServer);
TestUtils.waitUntilMetadataIsPropagated(scala.collection.JavaConversions.asScalaBuffer(servers), topic, 0, 30000);
}
Aggregations