当前位置: 首页>>代码示例>>Java>>正文


Java StormSubmitter.submitTopology方法代码示例

本文整理汇总了Java中backtype.storm.StormSubmitter.submitTopology方法的典型用法代码示例。如果您正苦于以下问题:Java StormSubmitter.submitTopology方法的具体用法?Java StormSubmitter.submitTopology怎么用?Java StormSubmitter.submitTopology使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backtype.storm.StormSubmitter的用法示例。


在下文中一共展示了StormSubmitter.submitTopology方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Config conf = new Config();
    conf.setMaxSpoutPending(5);
    if (args.length == 1) {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("wordCounter", conf, buildTopology(args[0]));
        Thread.sleep(60 * 1000);
        cluster.killTopology("wordCounter");
        cluster.shutdown();
        System.exit(0);
    }
    else if(args.length == 2) {
        conf.setNumWorkers(3);
        StormSubmitter.submitTopology(args[1], conf, buildTopology(args[0]));
    } else{
        System.out.println("Usage: TridentFileTopology <hdfs url> [topology name]");
    }
}
 
开发者ID:mengzhiyi,项目名称:storm-hbase-1.0.x,代码行数:19,代码来源:WordCountTrident.java

示例2: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        Config conf = new Config();
        int spout_Parallelism_hint = 1;
        int split_Parallelism_hint = 2;
        int count_Parallelism_hint = 2;

        TopologyBuilder builder = new TopologyBuilder();

        builder.setSpout("spout", new RaceSentenceSpout(), spout_Parallelism_hint);
        builder.setBolt("split", new SplitSentence(), split_Parallelism_hint).shuffleGrouping("spout");
        builder.setBolt("count", new WordCount(), count_Parallelism_hint).fieldsGrouping("split", new Fields("word"));
        String topologyName = RaceConfig.JstormTopologyName;

        try {
            StormSubmitter.submitTopology(topologyName, conf, builder.createTopology());
            //begin by Young
            
            //end by Young
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
 
开发者ID:yangliguang,项目名称:preliminary.demo,代码行数:25,代码来源:RaceTopology.java

示例3: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) {
    Config config = new Config();

    HdfsBolt hdfsBolt = makeHdfsBolt();
    KafkaSpout kafkaSpout = makeKafkaSpout(TOPIC, TOPOLOGY_NAME);

    LOG.info("Topology name is {}", TOPOLOGY_NAME);

    TopologyBuilder topologyBuilder = new TopologyBuilder();
    topologyBuilder.setSpout(KAFKA_SPOUT_ID, kafkaSpout, 10);
    topologyBuilder.setBolt(CROP_BOLT_ID, new CropBolt(), 10).shuffleGrouping(KAFKA_SPOUT_ID);
    topologyBuilder.setBolt(SPLIT_FIELDS_BOLT_ID, new SplitFieldsBolt(), 10).shuffleGrouping(CROP_BOLT_ID);
    topologyBuilder.setBolt(STORM_HDFS_BOLT_ID, hdfsBolt, 4).fieldsGrouping(SPLIT_FIELDS_BOLT_ID, new Fields("timestamp", "fieldvalues"));

    if (args != null && args.length > 0) {
        config.setDebug(false);
        config.setNumWorkers(3);

        try {
            StormSubmitter.submitTopology(args[0], config, topologyBuilder.createTopology());
        } catch (InvalidTopologyException | AlreadyAliveException | AuthorizationException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:lovelock,项目名称:storm-demo,代码行数:26,代码来源:LogStatisticsTopology.java

示例4: buildAndSubmit

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public void buildAndSubmit() throws Exception {
	 TopologyBuilder builder = new TopologyBuilder();
	 Config config = new Config();
     config.setDebug(true);
     // String nimbusHost = topologyConfig.getProperty("nimbus.host");
     config.put(Config.NIMBUS_HOST, "localhost");
     
     configureKafkaSpout(builder);
     configureRouteBolt(builder);
     configureInsertBolt(builder);
     
     //builder.setBolt("submitter", new SubmitBolt())
     //   .shuffleGrouping(ROUTE_BOLT);
     
     try {
         StormSubmitter.submitTopology("realestate-topology", config, builder.createTopology());
     } catch (Exception e) {
         LOG.error("Error submiting Topology", e);
     }

}
 
开发者ID:bucaojit,项目名称:RealEstate-Streaming,代码行数:22,代码来源:KafkaPhoenixTopology.java

示例5: SetRemoteTopology

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public  void SetRemoteTopology() throws AlreadyAliveException,
		InvalidTopologyException, TopologyAssignException {
	 Config conf = getConf();
	StormTopology topology = buildTopology();

	conf.put(Config.STORM_CLUSTER_MODE, "distributed");
	String streamName = (String) conf.get(Config.TOPOLOGY_NAME);
	if (streamName == null) {
		streamName = "SequenceTest";
	}

	if (streamName.contains("zeromq")) {
		conf.put(Config.STORM_MESSAGING_TRANSPORT,
				"com.alibaba.jstorm.message.zeroMq.MQContext");

	} else {
		conf.put(Config.STORM_MESSAGING_TRANSPORT,
				"com.alibaba.jstorm.message.netty.NettyContext");
	}

	StormSubmitter.submitTopology(streamName, conf,topology);
	
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:24,代码来源:SequenceTopologyTool.java

示例6: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
/**
 * Main method
 */
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
  if (args.length < 1) {
    throw new RuntimeException("Specify topology name");
  }

  int parallelism = 1;
  if (args.length > 1) {
    parallelism = Integer.parseInt(args[1]);
  }
  TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout("word", new WordSpout(), parallelism);
  builder.setBolt("consumer", new ConsumerBolt(), parallelism)
      .fieldsGrouping("word", new Fields("word"));
  Config conf = new Config();
  conf.setNumWorkers(parallelism);

  StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
 
开发者ID:twitter,项目名称:heron,代码行数:22,代码来源:WordCountTopology.java

示例7: submit

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
protected int submit(String name, Config conf, TopologyBuilder builder) {

        // register Metadata for serialization with FieldsSerializer
        Config.registerSerialization(conf, Metadata.class);

        if (isLocal) {
            LocalCluster cluster = new LocalCluster();
            cluster.submitTopology(name, conf, builder.createTopology());
            if (ttl != -1) {
                Utils.sleep(ttl * 1000);
                cluster.shutdown();
            }
        }

        else {
            try {
                StormSubmitter.submitTopology(name, conf,
                        builder.createTopology());
            } catch (Exception e) {
                e.printStackTrace();
                return -1;
            }
        }
        return 0;
    }
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:26,代码来源:ConfigurableTopology.java

示例8: submitTopology

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
private static void submitTopology(TopologyBuilder builder) {
	try {
		if (local_mode(conf)) {

			LocalCluster cluster = new LocalCluster();

			cluster.submitTopology(String.valueOf(conf.get("topology.name")), conf, builder.createTopology());

			Thread.sleep(200000);

			cluster.shutdown();
		} else {
			StormSubmitter.submitTopology(String.valueOf(conf.get("topology.name")), conf,
					builder.createTopology());
		}

	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:21,代码来源:TestTopology.java

示例9: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
/**
 * Get data from db and send message and email for someone or group.
 * @param args
 * @throws InvalidTopologyException 
 * @throws AlreadyAliveException 
 */
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
	TopologyBuilder builder=new TopologyBuilder();
	builder.setSpout("Log-VisitAlarm-Spout", new AppVisitAlarmSpout(),10);
	//�����ʼ�
	builder.setBolt("Log-Alarm-VisitErrorStatusCode-Bolt",new VisitErrorStatusBolt(), 10)
					.shuffleGrouping("Log-VisitAlarm-Spout");
	Config conf=new Config();
	conf.setDebug(false);
	conf.setNumWorkers(4);
	if (args != null && args.length > 0) {
		StormSubmitter.submitTopology(args[0], conf,builder.createTopology());
	} else {
		conf.setMaxTaskParallelism(1);
		LocalCluster cluster = new LocalCluster();
		cluster.submitTopology("AlarmErrorStatusCode", conf,builder.createTopology());
	}
}
 
开发者ID:yifzhang,项目名称:storm-miclog,代码行数:24,代码来源:AppVisitAlarmMain.java

示例10: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Config conf = ConfigUtil.readConfig(new File(args[1]));
    if (conf == null) {
        throw new RuntimeException("cannot find conf file " + args[1]);
    }

    TopologyBuilder builder = new TopologyBuilder();

    if (!ConfigUtil.getBoolean(conf, "spout.redis", false)) {
        builder.setSpout("say", new RandomSentenceSpout(), ConfigUtil.getInt(conf, "spout.parallelism", 1));
    } else {
        String host = (String) conf.get("redis.host");
        int port = ((Number) conf.get("redis.port")).intValue();
        String queue = (String) conf.get("redis.queue");
        builder.setSpout("say", new RedisSentenceSpout(host, port, queue),
                ConfigUtil.getInt(conf, "spout.parallelism", 1));
    }
    builder.setBolt("split", new SplitSentence(), ConfigUtil.getInt(conf, "split.parallelism", 1))
            .shuffleGrouping("say");
    builder.setBolt("counter", new WordCount(), ConfigUtil.getInt(conf, "counter.parallelism", 1))
            .fieldsGrouping("split", new Fields("word"));
    StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:24,代码来源:WordCountTopology.java

示例11: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
    BasicConfigurator.configure();

    if (args != null && args.length > 0)
    {
        StormSubmitter.submitTopology(
            args[0],
            createConfig(false),
            createTopology());
    }
    else
    {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology(
            "sentiment-analysis",
            createConfig(true),
            createTopology());
        Thread.sleep(60000);
        cluster.shutdown();
    }
}
 
开发者ID:zdata-inc,项目名称:StormSampleProject,代码行数:23,代码来源:SentimentAnalysisTopology.java

示例12: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
        Config conf = readConfig(new File(args[1]));

        if (conf == null) {
            throw new RuntimeException("cannot find conf file " + args[1]);
        }
        ResaConfig resaConfig = ResaConfig.create();
        resaConfig.putAll(conf);
        StormTopology topology = createTopology(resaConfig);
        if (args[0].equals("[local]")) {
            resaConfig.setDebug(false);
            LocalCluster localCluster = new LocalCluster();
            localCluster.submitTopology("local", resaConfig, topology);
        } else {
//            resaConfig.addDrsSupport();
            resaConfig.registerMetricsConsumer(RedisMetricsCollector.class);
            StormSubmitter.submitTopology(args[0], resaConfig, topology);
        }
    }
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:20,代码来源:LoadSimulateTopology.java

示例13: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws AlreadyAliveException,
			InvalidTopologyException {
		Config conf = new Config();
//		conf.setDebug(true);
		if (args == null || args.length == 0) {
			// local mode
			LocalCluster cluster = new LocalCluster();
			cluster.submitTopology(TOPOLOGY_NAME, conf, buildTopology());
		} else {
			// distributed mode

			conf.put(Config.STORM_CLUSTER_MODE, new String("distributed"));
			conf.setNumWorkers(1);

			StormSubmitter.submitTopology(args[0], conf, buildTopology());
		}
	}
 
开发者ID:mvogiatzis,项目名称:probabilistic-counting,代码行数:18,代码来源:ProbCountTopology.java

示例14: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
        Config conf = readConfig(new File(args[1]));

        if (conf == null) {
            throw new RuntimeException("cannot find conf file " + args[1]);
        }
        ResaConfig resaConfig = ResaConfig.create();
        resaConfig.putAll(conf);
        StormTopology topology = createTopology(resaConfig);
        if (args[0].equals("[local]")) {
            resaConfig.setDebug(false);
            LocalCluster localCluster = new LocalCluster();
            localCluster.submitTopology("local", resaConfig, topology);
        } else {
//            resaConfig.addDrsSupport();
            resaConfig.registerMetricsConsumer(RedisMetricsCollector.class);
            List<Double> dataSizes = Files.readAllLines(Paths.get(args[2])).stream().map(String::trim)
                    .filter(s -> !s.isEmpty()).map(Double::valueOf).collect(Collectors.toList());
            resaConfig.put("dataSizes", dataSizes);
            StormSubmitter.submitTopology(args[0], resaConfig, topology);
        }
    }
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:23,代码来源:LoadDataTopology.java

示例15: main

import backtype.storm.StormSubmitter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Config conf = new Config();

    if (args.length == 2) {
        // Ready & submit the topology
        String name = args[0];
        BrokerHosts hosts = new ZkHosts(args[1]);
        TransactionalTridentKafkaSpout kafkaSpout = TestUtils.testTweetSpout(hosts);

        StormSubmitter.submitTopology(name, conf, buildTopology(kafkaSpout));

    }else{
        System.err.println("<topologyName> <zookeeperHost>");
    }

}
 
开发者ID:eshioji,项目名称:trident-tutorial,代码行数:17,代码来源:TopHashtagByFollowerClass.java


注:本文中的backtype.storm.StormSubmitter.submitTopology方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。