use of org.apache.samza.config.JobCoordinatorConfig in project samza by apache.
the class TestZkStreamProcessorBase method createStreamProcessor.
protected StreamProcessor createStreamProcessor(final String pId, Map<String, String> map, final Object mutexStart, final Object mutexStop) {
map.put(ApplicationConfig.PROCESSOR_ID, pId);
Config config = new MapConfig(map);
JobCoordinator jobCoordinator = Util.<JobCoordinatorFactory>getObj(new JobCoordinatorConfig(config).getJobCoordinatorFactoryClassName()).getJobCoordinator(config);
StreamProcessorLifecycleListener listener = new StreamProcessorLifecycleListener() {
@Override
public void onStart() {
if (mutexStart != null) {
synchronized (mutexStart) {
mutexStart.notifyAll();
}
}
LOG.info("onStart is called for pid=" + pId);
}
@Override
public void onShutdown() {
if (mutexStop != null) {
synchronized (mutexStart) {
mutexStart.notify();
}
}
LOG.info("onShutdown is called for pid=" + pId);
}
@Override
public void onFailure(Throwable t) {
LOG.info("onFailure is called for pid=" + pId);
}
};
StreamProcessor processor = new StreamProcessor(config, new HashMap<>(), (StreamTaskFactory) TestStreamTask::new, listener, jobCoordinator);
return processor;
}
Aggregations