August 2017
Beginner to intermediate
284 pages
6h 51m
English
This grouping enables you to partition a stream on the basis of some of the fields in the tuples. For example, if you want all the tweets from a particular user to go to a single task, then you can partition the tweet stream using field grouping by username in the following manner:
builder.setSpout("1", new TweetSpout());
builder.setBolt("2", new TweetCounter()).fieldsGrouping("1", new Fields("username"))
As a result of the field grouping being hash (fields) % (no. of tasks), it does not guarantee that each of the tasks will get tuples to process. For example, if you have applied a field grouping on a field, say X, with only two possible values, A and B, and created two tasks for the bolt, then it might be possible that both ...
Read now
Unlock full access