use of com.hortonworks.streamline.streams.layout.component.impl.splitjoin.SplitProcessor in project streamline by hortonworks.
the class TopologyComponentFactory method splitProcessorProvider.
private Map.Entry<String, Provider<StreamlineProcessor>> splitProcessorProvider() {
Provider<StreamlineProcessor> provider = new Provider<StreamlineProcessor>() {
@Override
public StreamlineProcessor create(TopologyComponent component) {
Object splitConfig = component.getConfig().getAny(SplitProcessor.CONFIG_KEY_SPLIT);
ObjectMapper objectMapper = new ObjectMapper();
SplitAction splitAction = objectMapper.convertValue(splitConfig, SplitAction.class);
SplitProcessor splitProcessor = new SplitProcessor();
if (component instanceof TopologyOutputComponent) {
splitProcessor.addOutputStreams(createOutputStreams((TopologyOutputComponent) component));
} else {
throw new IllegalArgumentException("Component " + component + " must be an instance of TopologyOutputComponent");
}
splitProcessor.setSplitAction(splitAction);
return splitProcessor;
}
};
return new SimpleImmutableEntry<>(SPLIT, provider);
}
Aggregations