I need to do a groupby on tuples which fall in a tumblingWindow (the groupby is based on two other fields plus their time window) in Storm trident and then apply an aggregation function on them. The following code aggregates all tuples in a window:
topology.newStream("fixed_spout", fixedSpout).each(new Fields("flows"), new ExtractflowValues2("IPV4_SRC_ADDR"),new Fields("sa"))
.each(new Fields("flows"),new ExtractflowValues2("L4_DST_PORT"),new Fields("dp"))
.each(new Fields("flows"),new ExtractflowValues2("IPV4_DST_ADDR"),new Fields("da"))
.tumblingWindow(BaseWindowedBolt.Duration.seconds(5), wsf, new Fields(groupbyFileds), new countDistinct("da"), new Fields("count"));
In the above code I first extract 3 fields(sa,da and dp) from my tuples and then I put tuples in the windows of the duration of 5 seconds and count the number of their distinct "da"s for each window. However, what I really need is to put tuples in windows of the duration of 5 seconds and do a groupby on these tuples basd on their "sa" and "dp" fields and then count the number of their distinct "da"s. How can I achieve it?