Topology configuration example
Storm topology can be configured by the TopologyBuilder
class by creating spouts and bolts, and then by submitting the topology.
Spouts
Some implementations of spouts are available in Storm, such as BaseRichSpout, ClojureSpout, DRPCSpout, FeederSpout, FixedTupleSpout, MasterBatchCoordinator, RichShellSpout, RichSpoutBatchTriggerer, ShellSpout, SpoutTracker, TestPlannerSpout, TestWordSpout, and TransactionalSpoutCoordinator.
We can write a custom bolts by extending any of the aforementioned classes or implementing the ISpout interface:
public class NumberSpout extends BaseRichSpout { private SpoutOutputCollector collector; private static int currentNumber = 1; @Override public void open( Map conf, TopologyContext context, SpoutOutputCollector collector ) { this.collector = collector; } @Override public void nextTuple() { // Emit the next number collector.emit( new Values( new Integer...