inConsole = false;
}
org.apache.bookkeeper.conf.ClientConfiguration bkClientConf =
new org.apache.bookkeeper.conf.ClientConfiguration();
ServerConfiguration hubServerConf = new ServerConfiguration();
String serverCfgFile = cl.getOption("server-cfg");
if (serverCfgFile != null) {
try {
hubServerConf.loadConf(new File(serverCfgFile).toURI().toURL());
} catch (ConfigurationException e) {
throw new IOException(e);
}
try {
bkClientConf.loadConf(new File(serverCfgFile).toURI().toURL());
} catch (ConfigurationException e) {
throw new IOException(e);
}
}
ClientConfiguration hubClientCfg = new ClientConfiguration();
String clientCfgFile = cl.getOption("client-cfg");
if (clientCfgFile != null) {
try {
hubClientCfg.loadConf(new File(clientCfgFile).toURI().toURL());
} catch (ConfigurationException e) {
throw new IOException(e);
}
}
printMessage("Connecting to zookeeper/bookkeeper using HedwigAdmin");
try {
admin = new HedwigAdmin(bkClientConf, hubServerConf);
admin.getZkHandle().register(new MyWatcher());
} catch (Exception e) {
throw new IOException(e);
}
printMessage("Connecting to default hub server " + hubClientCfg.getDefaultServerHost());
hubClient = new HedwigClient(hubClientCfg);
publisher = hubClient.getPublisher();
subscriber = hubClient.getSubscriber();
// other parameters
myRegion = hubServerConf.getMyRegion();
}