Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
206 views
in Technique[技术] by (71.8m points)

java - Field Groping in Apache Storm - Looking for Motivational Examples

To understand the field-grouping of Apache Storm, I thought of creating a single spout which will emit few fixed lines to a bolt. The bolt (let's call it emitter) in turn will emit words along with a tag (in Storm's parlance a Field) say "WORD". In the next layer, I wanted to set up three bolts (call them counters) - expecting each of the counters to receive same words whenever the spout produce them. But I have never expected that the same words would be given to all of the counters- which is surprisingly what is happening with below topology.

TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("reader",new ReaderSpout());
builder.setBolt("emitter", new EmitterBolt()).shuffleGrouping("reader");
        
builder.setBolt("counter1", new CounterBolt(),1)
            .fieldsGrouping("emitter", new Fields("WORD"));
builder.setBolt("counter2", new CounterBolt(),1)
        .fieldsGrouping("emitter", new Fields("WORD"));
builder.setBolt("counter3", new CounterBolt(),1)
        .fieldsGrouping("emitter", new Fields("WORD"));

Any help will be much appreciated. My primary objective to understand the usefulness of 'fieldsGrouping', and soft objective is to have a two counter-bolts one receiving words staring with vowel and other bolts receiving words starting with consonants.

question from:https://stackoverflow.com/questions/65944382/field-groping-in-apache-storm-looking-for-motivational-examples

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...