Hi
Could some one pls help with FieldGrouping issue i am having pls.
I am using the WordCount example from Getting Started book of Storm.
Here is the input i am providing just 1 line:
Apache Storm is great.
I have tried using 1 Spout, 1 SplitSentenceBolt and 2 WordCountBolts, and 1
Report Bolt.
Here is the topology that i have used:
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SENTENCE_SPOUT_ID, spout, 1);
// SentenceSpout --> SplitSentenceBolt
builder.setBolt(SPLIT_BOLT_ID, splitBolt, 1)
.shuffleGrouping(SENTENCE_SPOUT_ID);
// SplitSentenceBolt --> WordCountBolt
builder.setBolt(COUNT_BOLT_ID, countBolt, 2)
.fieldsGrouping(SPLIT_BOLT_ID, new Fields("word"));
// WordCountBolt --> ReportBolt
builder.setBolt(REPORT_BOLT_ID, reportBolt)
.globalGrouping(COUNT_BOLT_ID);
Here is the code in WordCountBolt>>declareOutputFields:
public void declareOutputFields(OutputFieldsDeclarer declarer) {
Sop("3 WordCountBolt dOFs WordCountBolt --> word,count ");
declarer.declare(new Fields("word", "count"));
}
Since i have used a parallelism of 2 here for WCBolt:
builder.setBolt(COUNT_BOLT_ID, countBolt, 2)
i have assumed there will be 2 instances of WordCountBolt needs to be
created which means the above method
declareOutputFields should be called twice as the Fields should be
partitioned and routed to 2 diff instances of WCBolt. But i am noticing
there is only 1 instance of WCBolt getting created in other words i am
logging via the declareOutputFields method to find how many instances of
WCBolt are created and there is only 1 print statement printed.
I have also tried using multiple lines as input but noticed only 1 instance
of WCBolt is getting created even for multiple lines input.
Could some one pls provide any suggestions if i am doing any thing
incorrect here.
Your help will be really appreciated.
Thanks
Sai