use of kafka.metrics.KafkaMetricsReporter in project opennms by OpenNMS.
the class JUnitKafkaServer method before.
@Override
public void before() throws Exception {
zkServer = new TestingServer();
// Start ZooKeeper, this method will block until the service has started
zkServer.start();
getAvailablePort(kafkaPort, 9192);
// Delete any existing Kafka log directory
FileUtils.deleteDirectory(new File("target/kafka-log"));
localhost = getLocalhost();
final Properties properties = new Properties();
properties.put("broker.id", "1");
properties.put("auto.create.topics.enable", "true");
properties.put("num.partitions", "100");
properties.put("enable.zookeeper", "true");
properties.put("host.name", localhost);
properties.put("log.dir", "target/kafka-log");
properties.put("port", String.valueOf(kafkaPort.get()));
properties.put("zookeeper.connect", zkServer.getConnectString());
properties.put("listeners", "PLAINTEXT://" + "localhost:" + String.valueOf(kafkaPort.get()));
System.err.println("Kafka server properties: " + properties);
kafkaConfig = new KafkaConfig(properties);
final List<KafkaMetricsReporter> kmrList = new ArrayList<>();
final Buffer<KafkaMetricsReporter> metricsList = scala.collection.JavaConversions.asScalaBuffer(kmrList);
kafkaServer = new KafkaServer(kafkaConfig, new SystemTime(), Option.<String>empty(), metricsList);
kafkaServer.startup();
await().atMost(1, MINUTES).until(this::getBrokerMetadatas, hasSize(greaterThanOrEqualTo(1)));
System.err.println("Kafka Address: " + getKafkaConnectString());
System.err.println("Zookeeper Address: " + getZookeeperConnectString());
}
use of kafka.metrics.KafkaMetricsReporter in project deeplearning4j by deeplearning4j.
the class EmbeddedKafkaCluster method startBroker.
private KafkaServer startBroker(Properties props) {
List<KafkaMetricsReporter> kmrList = new ArrayList<>();
Buffer<KafkaMetricsReporter> metricsList = scala.collection.JavaConversions.asScalaBuffer(kmrList);
KafkaServer server = new KafkaServer(new KafkaConfig(props), new SystemTime(), Option.<String>empty(), metricsList);
server.startup();
return server;
}
use of kafka.metrics.KafkaMetricsReporter in project camel by apache.
the class EmbeddedKafkaBroker method startBroker.
private KafkaServer startBroker(Properties props) {
List<KafkaMetricsReporter> kmrList = new ArrayList<>();
Buffer<KafkaMetricsReporter> metricsList = scala.collection.JavaConversions.asScalaBuffer(kmrList);
KafkaServer server = new KafkaServer(new KafkaConfig(props), new SystemTime(), Option.<String>empty(), metricsList);
server.startup();
return server;
}
use of kafka.metrics.KafkaMetricsReporter in project atlas by apache.
the class EmbeddedKafkaServer method startKafka.
private void startKafka() throws IOException, URISyntaxException {
String kafkaValue = properties.getProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG);
LOG.info("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));
List<KafkaMetricsReporter> metrics = new ArrayList<>();
Buffer<KafkaMetricsReporter> metricsReporters = scala.collection.JavaConversions.asScalaBuffer(metrics);
kafkaServer = new KafkaServer(KafkaConfig.fromProps(brokerConfig), new SystemTime(), Option.apply(this.getClass().getName()), metricsReporters);
kafkaServer.startup();
LOG.info("Embedded kafka server started with broker config {}", brokerConfig);
}
use of kafka.metrics.KafkaMetricsReporter in project wildfly-camel by wildfly-extras.
the class EmbeddedKafkaBroker method startBroker.
private KafkaServer startBroker(Properties props) {
List<KafkaMetricsReporter> kmrList = new ArrayList<>();
Buffer<KafkaMetricsReporter> metricsList = scala.collection.JavaConversions.asScalaBuffer(kmrList);
KafkaServer server = new KafkaServer(new KafkaConfig(props), new SystemTime(), Option.<String>empty(), metricsList);
server.startup();
return server;
}
Aggregations