use of org.apache.samza.config.ConfigFactory in project samza by apache.
the class SamzaTaskProxy method getCoordinatorSystemConfig.
/**
* Builds coordinator system config for the {@param jobInstance}.
* @param jobInstance the job instance to get the jobModel for.
* @return the constructed coordinator system config.
*/
private Config getCoordinatorSystemConfig(JobInstance jobInstance) {
try {
InstallationRecord record = installFinder.getAllInstalledJobs().get(jobInstance);
ConfigFactory configFactory = ClassLoaderHelper.fromClassName(taskResourceConfig.getJobConfigFactory());
Config config = configFactory.getConfig(new URI(String.format("file://%s", record.getConfigFilePath())));
Map<String, String> configMap = ImmutableMap.of(JobConfig.JOB_ID(), jobInstance.getJobId(), JobConfig.JOB_NAME(), jobInstance.getJobName());
return Util.buildCoordinatorStreamConfig(new MapConfig(ImmutableList.of(config, configMap)));
} catch (Exception e) {
LOG.error(String.format("Failed to get coordinator stream config for job : %s", jobInstance), e);
throw new SamzaException(e);
}
}
Aggregations