Apache storm 如何在apache storm中在单个拓扑中提交多个喷口?

Apache storm 如何在apache storm中在单个拓扑中提交多个喷口?,apache-storm,apache-storm-flux,Apache Storm,Apache Storm Flux,我试图在apache Storm中使用并行概念。我想知道如何通过单个拓扑提交多个喷口 下面是我提交单个拓扑的代码 TwitterTopologyCreator topology = new TwitterTopologyCreator(); topology.createTopology(topologyName, clientName); 可以按以下方式在拓扑中使用多个喷口 TwitterTopologyCreator topology = new TwitterTopologyCreato

我试图在apache Storm中使用并行概念。我想知道如何通过单个拓扑提交多个喷口

下面是我提交单个拓扑的代码

TwitterTopologyCreator topology = new TwitterTopologyCreator();
topology.createTopology(topologyName, clientName);

可以按以下方式在拓扑中使用多个喷口

TwitterTopologyCreator topology = new TwitterTopologyCreator();    
topology.setSpout("kafka-spout1", new KafkaSpout(spoutConf1), 1); 
topology.setSpout("kafka-spout2", new KafkaSpout(spoutConf2), 1);
topology.createTopology(topologyName, clientName);

可以按以下方式在拓扑中使用多个喷口

TwitterTopologyCreator topology = new TwitterTopologyCreator();    
topology.setSpout("kafka-spout1", new KafkaSpout(spoutConf1), 1); 
topology.setSpout("kafka-spout2", new KafkaSpout(spoutConf2), 1);
topology.createTopology(topologyName, clientName);

有两个喷口,可以有多种配置。我张贴了一些常用的拓扑结构配置与2喷口

public class Test {    
    public static void main(String[] args) throws Exception {           
        /*
         * 
         * topology with 2 spout (configuration 1)
         * 
         * spout-1 -->
         *            |-->  bolt-1
         * spout-2 -->
         * 
         */

        TopologyBuilder configuration1=new TopologyBuilder();
        configuration1.setSpout("spout-1", new Spout1());
        configuration1.setSpout("spout-2", new Spout2());
        configuration1.setBolt("bolt-1", new Bolt1()).shuffleGrouping("spout-1").shuffleGrouping("spout-2");

        /*
         * 
         * topology with 2 spout (configuration 2)
         * 
         * spout-1 --> bolt-1
         *      
         * spout-2 --> bolt-2
         * 
         */

        TopologyBuilder configuration2=new TopologyBuilder();
        configuration2.setSpout("spout-1", new Spout1());
        configuration2.setSpout("spout-2", new Spout2());
        configuration2.setBolt("bolt-1", new Bolt1()).shuffleGrouping("spout-1");
        configuration2.setBolt("bolt-2", new Bolt2()).shuffleGrouping("spout-2");

        /*
         * 
         * topology with 2 spout (configuration 3)
         * 
         * spout-1 --> bolt-1 -->
         *                        |--> bolt-3
         * spout-2 --> bolt-2 -->
         * 
         */
        TopologyBuilder configuration3=new TopologyBuilder();
        configuration2.setSpout("spout-1", new Spout1());
        configuration2.setSpout("spout-2", new Spout2());
        configuration2.setBolt("bolt-1", new Bolt1()).shuffleGrouping("spout-1");
        configuration2.setBolt("bolt-2", new Bolt2()).shuffleGrouping("spout-2");
        configuration2.setBolt("bolt-3", new Bolt3()).shuffleGrouping("bolt-1").shuffleGrouping("bolt-2");                          
    }    
}

有两个喷口,可以有多种配置。我张贴了一些常用的拓扑结构配置与2喷口

public class Test {    
    public static void main(String[] args) throws Exception {           
        /*
         * 
         * topology with 2 spout (configuration 1)
         * 
         * spout-1 -->
         *            |-->  bolt-1
         * spout-2 -->
         * 
         */

        TopologyBuilder configuration1=new TopologyBuilder();
        configuration1.setSpout("spout-1", new Spout1());
        configuration1.setSpout("spout-2", new Spout2());
        configuration1.setBolt("bolt-1", new Bolt1()).shuffleGrouping("spout-1").shuffleGrouping("spout-2");

        /*
         * 
         * topology with 2 spout (configuration 2)
         * 
         * spout-1 --> bolt-1
         *      
         * spout-2 --> bolt-2
         * 
         */

        TopologyBuilder configuration2=new TopologyBuilder();
        configuration2.setSpout("spout-1", new Spout1());
        configuration2.setSpout("spout-2", new Spout2());
        configuration2.setBolt("bolt-1", new Bolt1()).shuffleGrouping("spout-1");
        configuration2.setBolt("bolt-2", new Bolt2()).shuffleGrouping("spout-2");

        /*
         * 
         * topology with 2 spout (configuration 3)
         * 
         * spout-1 --> bolt-1 -->
         *                        |--> bolt-3
         * spout-2 --> bolt-2 -->
         * 
         */
        TopologyBuilder configuration3=new TopologyBuilder();
        configuration2.setSpout("spout-1", new Spout1());
        configuration2.setSpout("spout-2", new Spout2());
        configuration2.setBolt("bolt-1", new Bolt1()).shuffleGrouping("spout-1");
        configuration2.setBolt("bolt-2", new Bolt2()).shuffleGrouping("spout-2");
        configuration2.setBolt("bolt-3", new Bolt3()).shuffleGrouping("bolt-1").shuffleGrouping("bolt-2");                          
    }    
}