Storm simple patterns
While we work with Storm, there are a variety of patterns you can recognize. In the segment here, without using Trident, we are attempting to capture some common patterns with Storm topologies.
Joins
As the name suggests, this is the most common pattern. The output from two or more different streams is joined on some common field and is emitted as a single tuple. In Storm, that's effectively achieved using fields grouping, which ensures that all the tuples with same field value are emitted to the same task. The following figure and code snippet captures its essence:
TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("gender", genderSpout); builder.setSpout("age", ageSpout); builder.setBolt("join", new SingleJoinBolt(new Fields("gender", "age"))).fieldsGrouping("gender", new Fields("id")) .fieldsGrouping("age", new Fields("id"));
That's...