use of co.cask.cdap.filetailer.config.exception.ConfigurationLoadingException in project cdap-ingest by caskdata.
the class ConfigurationLoaderImpl method load.
@Override
public Configuration load(File file) throws ConfigurationLoadingException {
LOG.debug("Start initializing loader with file: {}", file.getAbsolutePath());
Properties properties = new Properties();
try {
InputStream is = new FileInputStream(file);
try {
properties.load(is);
LOG.debug("Loader successfully initialized with file: {}", file.getAbsolutePath());
} finally {
Closeables.closeQuietly(is);
}
} catch (IOException e) {
LOG.error("Cannot load properties", e);
throw new ConfigurationLoadingException("Cannot load properties: " + e.getMessage());
}
return new ConfigurationImpl(properties);
}
use of co.cask.cdap.filetailer.config.exception.ConfigurationLoadingException in project cdap-ingest by caskdata.
the class PipeManager method setupPipes.
/**
* Pipes setup
*
* @throws IOException in case a client stream cannot be created
*/
private ServiceManager setupPipes() throws IOException {
StreamClient client = null;
StreamWriter writer = null;
try {
List<PipeConfiguration> pipeConfList = getPipeConfigs();
for (PipeConfiguration pipeConf : pipeConfList) {
FileTailerQueue queue = new FileTailerQueue(pipeConf.getQueueSize());
client = pipeConf.getSinkConfiguration().getStreamClient();
String streamName = pipeConf.getSinkConfiguration().getStreamName();
writer = getStreamWriterForPipe(client, streamName);
FileTailerStateProcessor stateProcessor = new FileTailerStateProcessorImpl(pipeConf.getDaemonDir(), pipeConf.getStateFile());
FileTailerMetricsProcessor metricsProcessor = new FileTailerMetricsProcessor(pipeConf.getDaemonDir(), pipeConf.getStatisticsFile(), pipeConf.getStatisticsSleepInterval(), pipeConf.getPipeName(), pipeConf.getSourceConfiguration().getFileName());
pipeList.add(new Pipe(new LogTailer(pipeConf, queue, stateProcessor, metricsProcessor, null), new FileTailerSink(queue, writer, SinkStrategy.LOADBALANCE, stateProcessor, metricsProcessor, null, pipeConf.getSinkConfiguration().getPackSize()), metricsProcessor));
client = null;
writer = null;
}
return new ServiceManager(pipeList);
} catch (ConfigurationLoadingException e) {
throw new ConfigurationLoadingException("Error during loading configuration from file: " + confFile.getAbsolutePath() + e.getMessage());
} finally {
if (client != null) {
client.close();
}
if (writer != null) {
writer.close();
}
}
}
Aggregations