Search in sources :

Example 1 with SplitProcessor

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);
}
Also used : TopologyComponent(com.hortonworks.streamline.streams.catalog.TopologyComponent) StreamlineProcessor(com.hortonworks.streamline.streams.layout.component.StreamlineProcessor) TopologyOutputComponent(com.hortonworks.streamline.streams.catalog.TopologyOutputComponent) SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) SplitAction(com.hortonworks.streamline.streams.layout.component.impl.splitjoin.SplitAction) SplitProcessor(com.hortonworks.streamline.streams.layout.component.impl.splitjoin.SplitProcessor) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 TopologyComponent (com.hortonworks.streamline.streams.catalog.TopologyComponent)1 TopologyOutputComponent (com.hortonworks.streamline.streams.catalog.TopologyOutputComponent)1 StreamlineProcessor (com.hortonworks.streamline.streams.layout.component.StreamlineProcessor)1 SplitAction (com.hortonworks.streamline.streams.layout.component.impl.splitjoin.SplitAction)1 SplitProcessor (com.hortonworks.streamline.streams.layout.component.impl.splitjoin.SplitProcessor)1 SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)1