use of org.apache.storm.topology.twister2.Twister2Spout in project twister2 by DSC-SPIDAL.
the class TopologyBuilder method setSpout.
public SpoutDeclarer setSpout(String id, IRichSpout spout, Number parallelismHint) {
Twister2Spout twister2Spout = new Twister2Spout(id, spout);
twister2Spout.setParallelism(parallelismHint.intValue());
this.nodes.put(id, twister2Spout);
this.sourceNodes.add(id);
return twister2Spout.getSpoutDeclarer();
}
use of org.apache.storm.topology.twister2.Twister2Spout in project twister2 by DSC-SPIDAL.
the class TopologyBuilder method createTopology.
public StormTopology createTopology() {
this.sourceNodes.forEach(source -> {
Twister2Spout twister2Spout = (Twister2Spout) nodes.get(source);
LOG.info("Adding source : " + source);
this.computeGraphBuilder.addSource(source, twister2Spout, twister2Spout.getParallelism());
});
this.computeNodes.forEach(compute -> {
Twister2Bolt twister2Bolt = (Twister2Bolt) nodes.get(compute);
ComputeConnection computeConnection = this.computeGraphBuilder.addCompute(compute, twister2Bolt, twister2Bolt.getParallelism());
this.defineGrouping(twister2Bolt, computeConnection);
});
this.sinkNodes.forEach(sink -> {
Twister2Bolt twister2Bolt = (Twister2Bolt) nodes.get(sink);
ComputeConnection computeConnection = this.computeGraphBuilder.addCompute(sink, twister2Bolt, twister2Bolt.getParallelism());
this.defineGrouping(twister2Bolt, computeConnection);
});
this.computeGraphBuilder.setMode(OperationMode.STREAMING);
return new StormTopology(this.computeGraphBuilder.build());
}
Aggregations