storm 多spout和bolt

TopologyBuilder builder = new TopologyBuilder();
                            
                            
                            Set<String> FlashPlayerSpoutSet = new HashSet<String>();
                            String [] PlayPlayerDataSourceAddrList = SysConfig._DATA_SOURCE_ADDR_LIST;
                            for(int i = 0; i < PlayPlayerDataSourceAddrList.length; ++i ){
                                     String FlashPlayerSpoutName = "FlashPlayerSpout" + i;
                                     builder.setSpout(FlashPlayerSpoutName, new FlashSpout(PlayPlayerDataSourceAddrList[i]), 1);
                                     FlashPlayerSpoutSet.add(FlashPlayerSpoutName);
                            }
                            
                           
                            BoltDeclarer ajustBolt = builder.setBolt("adjust", new AdjustTimeBolt(), 5);
                            for (String spoutName : FlashPlayerSpoutSet){
                                     ajustBolt.shuffleGrouping(spoutName);
                            }
                            
                            
                            
                            
                            builder.setBolt("PCPlayFluentStatBolt", new PlayerFluenceStatBolt("pc"), 3).fieldsGrouping(
                                               "adjust", new Fields("streamid"));
                            builder.setBolt("PCPlayFluentStatDBBolt",new PlayerFluenceStatMysqlBolt(), 3)
                                               .shuffleGrouping("PCPlayFluentStatBolt");
                            builder.setBolt("PCPlayFluentHbaseBolt",new PlayFluentHbaseBolt(), 1)
                                    .fieldsGrouping("PCPlayFluentStatBolt", new Fields("streamid"));//HBASE
                            
                            
                            //统计播放流畅率
                            builder.setBolt("AppPlayFluentStatBolt", new PlayerFluenceStatBolt("mobile"), 3).fieldsGrouping(
                                               "adjust", new Fields("streamid"));
                            builder.setBolt("AppPlayFluentStatDBBolt",new PlayerFluenceStatMysqlBolt(), 3)
                                               .fieldsGrouping("AppPlayFluentStatBolt", new Fields("streamid"));
                            builder.setBolt("AppPlayFluentHbaseBolt",new PlayFluentHbaseBolt(), 1)
                          .fieldsGrouping("AppPlayFluentStatBolt", new Fields("streamid"));//HBASE
                   
                                    
                            builder.setBolt("UserCntStatBolt", new UserCntStatBolt("all"), 1).shuffleGrouping( "adjust");
                            
                            builder.setBolt("OnlineUserDetailHbaseBolt",new OnlineUserDetailHbaseBolt(3, -1), 1)
                                      .shuffleGrouping("UserCntStatBolt");//HBASE1
                            
                            
                           
                            builder.setSpout("Upload_Spout", new ReceiverSpout(), 1);
                            builder.setBolt("UploadDetailHbaseBolt0", new UploadHbaseBolt(3, -1), 1).shuffleGrouping("Upload_Spout");//Hbase

你可能感兴趣的:(storm 多spout和bolt)