new KafkaServerMain().doMain(args);
}
@Override
public void init(String[] args) {
CConfiguration cConf = CConfiguration.create();
String zkConnectStr = cConf.get(Constants.Zookeeper.QUORUM);
String zkNamespace = cConf.get(KafkaConstants.ConfigKeys.ZOOKEEPER_NAMESPACE_CONFIG);
int port = cConf.getInt(KafkaConstants.ConfigKeys.PORT_CONFIG, -1);
String hostname = cConf.get(KafkaConstants.ConfigKeys.HOSTNAME_CONFIG);
InetAddress address = Networks.resolve(hostname, new InetSocketAddress("localhost", 0).getAddress());
if (address.isAnyLocalAddress()) {
try {
address = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
throw Throwables.propagate(e);
}
}
if (address.isLoopbackAddress()) {
LOG.warn("Binding to loopback address!");
}
hostname = address.getCanonicalHostName();
int numPartitions = cConf.getInt(KafkaConstants.ConfigKeys.NUM_PARTITIONS_CONFIG,
KafkaConstants.DEFAULT_NUM_PARTITIONS);
String logDir = cConf.get(KafkaConstants.ConfigKeys.LOG_DIR_CONFIG);
int replicationFactor = cConf.getInt(KafkaConstants.ConfigKeys.REPLICATION_FACTOR,
KafkaConstants.DEFAULT_REPLICATION_FACTOR);
LOG.info("Using replication factor {}", replicationFactor);
if (zkNamespace != null) {
ZKClientService client = ZKClientService.Builder.of(zkConnectStr).build();