聊聊storm trident batch的分流与聚合
序 本文主要研究一下storm trident batch的分流与聚合 实例 TridentTopology topology = new TridentTopology(); topology.newStream("spout1", spout) .partitionBy(new Fields("user")) .partitionAggregate(new Fields("user","score","batchId"),new OriginUserCountAggregator(),new Fields("result","aggBatchId")) .parallelismHint(3) .global() .aggregate(new Fields("result","aggBatchId"),new AggAgg(),new Fields("agg")) .each(new Fields("agg"),new PrintEachFunc(),new Fields()) ; 这里最后构造了3个bolt,分别为b-0、b-1、b-2 b-0主要是partitionAggregate,它的parallelismHint为3 b-1主要是处理CombinerAggregator的init,它的parallelismHint为1,由于它的上游bolt有3个task