本文整理汇总了Java中backtype.storm.testing.TestWordSpout类的典型用法代码示例。如果您正苦于以下问题:Java TestWordSpout类的具体用法?Java TestWordSpout怎么用?Java TestWordSpout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestWordSpout类属于backtype.storm.testing包,在下文中一共展示了TestWordSpout类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 10);
builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word");
builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1");
Config conf = new Config();
conf.setDebug(true);
if (args != null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
}
else {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
Utils.sleep(10000);
cluster.killTopology("test");
cluster.shutdown();
}
}
开发者ID:luozhaoyu,项目名称:big-data-system,代码行数:25,代码来源:ExclamationTopology.java
示例2: run
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
void run(String[] args) {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word_spout", new TestWordSpout(), 2);
builder.setBolt("tuple_double", new Function(new Double(), new Fields("word1", "word2")), 2).shuffleGrouping("word_spout");
Map conf = new HashMap();
conf.put(Config.TOPOLOGY_WORKERS, 4);
conf.put(Config.TOPOLOGY_DEBUG, true);
if(args.length==0) {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("MockIngest", conf, builder.createTopology());
} else {
try {
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} catch(Exception e) {
e.printStackTrace();
}
}
}
开发者ID:brennonyork,项目名称:storm-lib,代码行数:22,代码来源:FunctionTopology.java
示例3: run
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
void run(String[] args) {
TopologyBuilder builder = new TopologyBuilder();
KVSchema names = new KVSchema("names", "word");
names.colFam.addStatic("NAME");
names.colQual.add("word").addStatic("\u0000").add("word");
builder.setSpout("word_spout", new TestWordSpout(), 2);
builder.setBolt("mutate", new BatchMutation(names, true), 2).shuffleGrouping("word_spout");
Map conf = new HashMap();
conf.put(Config.TOPOLOGY_WORKERS, 4);
conf.put(Config.TOPOLOGY_DEBUG, true);
if(args.length==0) {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("MockIngest", conf, builder.createTopology());
} else {
try {
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} catch(Exception e) {
e.printStackTrace();
}
}
}
开发者ID:brennonyork,项目名称:storm-lib,代码行数:26,代码来源:BatchMutationTopology.java
示例4: main
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 10);
builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word");
builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1");
Config conf = new Config();
conf.setDebug(true);
if (args != null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
}
else {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("www_nginx_accesslog_stat", conf, builder.createTopology());
Utils.sleep(10000);
cluster.killTopology("www_nginx_accesslog_stat");
cluster.shutdown();
}
}
开发者ID:coodoing,项目名称:LogRTA,代码行数:25,代码来源:ExclamationTopology.java
示例5: main
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 10);
builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word");
builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1");
Config conf = new Config();
conf.setDebug(true);
if (args != null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
else {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
Utils.sleep(10000);
cluster.killTopology("test");
cluster.shutdown();
}
}
开发者ID:metamx,项目名称:incubator-storm,代码行数:25,代码来源:ExclamationTopology.java
示例6: main
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 10);
builder.setBolt("exclaim1", new ExclamationBolt(), 3)
.shuffleGrouping("word");
builder.setBolt("exclaim2", new ExclamationBolt(), 2)
.shuffleGrouping("exclaim1");
Config conf = new Config();
conf.setDebug(true);
if(args!=null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} else {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
Utils.sleep(10000);
cluster.killTopology("test");
cluster.shutdown();
}
}
开发者ID:adarshms,项目名称:sentweet,代码行数:26,代码来源:ExclamationTopology.java
示例7: main
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 10);
builder.setBolt("exclaim1", new ExclamationBolt(), 3)
.shuffleGrouping("word");
builder.setBolt("exclaim2", new ExclamationBolt(), 2)
.shuffleGrouping("exclaim1");
Config conf = new Config();
conf.setDebug(true);
if(args!=null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} else {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
Utils.sleep(100000);
cluster.killTopology("test");
cluster.shutdown();
}
}
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:26,代码来源:ExclamationTopology.java
示例8: wireTopology
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
String spoutId = "wordGenerator";
String counterId = "counter";
String intermediateRankerId = "intermediateRanker";
String totalRankerId = "finalRanker";
builder.setSpout(spoutId, new TestWordSpout(), 5);
builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).fieldsGrouping(spoutId, new Fields("word"));
builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(counterId, new Fields(
"obj"));
builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
}
开发者ID:luozhaoyu,项目名称:big-data-system,代码行数:12,代码来源:RollingTopWords.java
示例9: run
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
void run(String[] args) {
TopologyBuilder builder = new TopologyBuilder();
KVSchema names = new KVSchema("names", "word");
names.colFam.addStatic("NAME");
names.colQual.add("word").addStatic("\u0000").add("word");
KVSchema people = new KVSchema("people", "word");
people.colFam.addStatic("PEOPLE");
people.colQual.add("word").addStatic("\u0000").add("word");
builder.setSpout("word_spout", new TestWordSpout(), 2);
builder.setBolt("mutate", new BulkMutation(names), 2).shuffleGrouping("word_spout");
builder.setBolt("mutateII", new BulkMutation(people), 3).shuffleGrouping("word_spout");
builder.setBolt("ingest", new BulkIngest("/tmp/ingest"), 2)
.shuffleGrouping("mutate")
.shuffleGrouping("mutateII");
Map conf = new HashMap();
conf.put(Config.TOPOLOGY_WORKERS, 4);
conf.put(Config.TOPOLOGY_DEBUG, true);
conf.put("bulk.output.path", "/tmp/rf");
conf.put("bulk.write.timeout", 10);
conf.put("bulk.max.records", 1000);
conf.put("zookeeper.servers", "localhost");
conf.put("zookeeper.instance.name", "dev_instance");
conf.put("accumulo.user", "root");
conf.put("accumulo.passwd", "dev_instance");
if(args.length==0) {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("MockIngest", conf, builder.createTopology());
} else {
try {
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} catch(Exception e) {
e.printStackTrace();
}
}
}
开发者ID:brennonyork,项目名称:storm-lib,代码行数:41,代码来源:BulkIngestTopology.java
示例10: run
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
void run(String[] args) {
TopologyBuilder builder = new TopologyBuilder();
KVSchema names = new KVSchema("names", "word");
names.colFam.addStatic("NAME");
names.colQual.add("word").addStatic("\u0000").add("word");
builder.setSpout("word_spout", new TestWordSpout(), 2);
builder.setBolt("mutate", new BulkMutation(names), 2).shuffleGrouping("word_spout");
Map conf = new HashMap();
conf.put(Config.TOPOLOGY_WORKERS, 4);
conf.put(Config.TOPOLOGY_DEBUG, true);
conf.put("bulk.output.path", "/tmp/rf");
conf.put("bulk.write.timeout", 10);
conf.put("bulk.max.records", 1000);
if(args.length==0) {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("MockIngest", conf, builder.createTopology());
} else {
try {
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} catch(Exception e) {
e.printStackTrace();
}
}
}
开发者ID:brennonyork,项目名称:storm-lib,代码行数:29,代码来源:BulkMutationTopology.java
示例11: wireTopology
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
String spoutId = "wordGenerator";
String counterId = "counter";
String intermediateRankerId = "intermediateRanker";
String totalRankerId = "finalRanker";
builder.setSpout(spoutId, new TestWordSpout(), 5);
builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).fieldsGrouping(spoutId, new Fields("word"));
builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(counterId,
new Fields("obj"));
builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
}
开发者ID:adarshms,项目名称:sentweet,代码行数:12,代码来源:RollingTopWords.java
示例12: test
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void test() throws Exception {
JStormHelper.cleanCluster();
hosts = JStormHelper.getSupervisorHosts();
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 1);
/*********
*
* This make sure the tasks will run on different nodes
*
*
*
*/
Map<String, Object> componentMap = new HashMap<>();
ConfigExtension.setTaskOnDifferentNode(componentMap, true);
builder.setBolt(BOLT_NAME, new ExclamationLoggingBolt(), hosts.size()).localFirstGrouping("word")
.addConfigurations(componentMap);
if (isLocal == false) {
if (spoutSingle == true) {
conf.setNumWorkers(hosts.size() + 3);
} else {
conf.setNumWorkers(hosts.size());
}
}
String[] className = Thread.currentThread().getStackTrace()[1].getClassName().split("\\.");
String topologyName = className[className.length - 1];
try {
JStormHelper.runTopology(builder.createTopology(), topologyName, conf, 180,
new Validator(conf), isLocal);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Assert.fail("Failed");
}
}
开发者ID:alibaba,项目名称:jstorm,代码行数:41,代码来源:TaskInDifferentNodeTopology.java
示例13: test
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void test() {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 10);
builder.setBolt("exclaim1", new ExclamationLoggingBolt(), 3).noneGrouping("word");
builder.setBolt("exclaim2", new ExclamationLoggingBolt(), 2).shuffleGrouping("exclaim1");
String hostname = NetWorkUtils.hostname();
List<String> hosts = new ArrayList<String>();
hosts.add(hostname);
/*********
*
* This make sure all worker run on the user-defined hosts
*
*
*
*/
conf.put(Config.ISOLATION_SCHEDULER_MACHINES, hosts);
String[] className = Thread.currentThread().getStackTrace()[1].getClassName().split("\\.");
String topologyName = className[className.length - 1];
try {
JStormHelper.runTopology(builder.createTopology(), topologyName, conf, 60,
new Validator(conf), isLocal);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Assert.fail("Failed");
}
}
开发者ID:alibaba,项目名称:jstorm,代码行数:32,代码来源:UserDefinedHostsTopology.java
示例14: wireTopology
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
String spoutId = "wordGenerator";
String counterId = "counter";
String intermediateRankerId = "intermediateRanker";
String totalRankerId = "finalRanker";
builder.setSpout(spoutId, new TestWordSpout(), 5);
builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).fieldsGrouping(spoutId, new Fields("word"));
builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(counterId,
new Fields("obj"));
builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
}
开发者ID:alibaba,项目名称:jstorm,代码行数:12,代码来源:RollingTopWords.java
示例15: wireTopology
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
String spoutId = "wordGenerator";
String counterId = "counter";
String aggId = "aggregator";
String intermediateRankerId = "intermediateRanker";
String totalRankerId = "finalRanker";
builder.setSpout(spoutId, new TestWordSpout(), 5);
builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).partialKeyGrouping(spoutId, new Fields("word"));
builder.setBolt(aggId, new RollingCountAggBolt(), 4).fieldsGrouping(counterId, new Fields("obj"));
builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(aggId,
new Fields("obj"));
builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
}
开发者ID:alibaba,项目名称:jstorm,代码行数:14,代码来源:SkewedRollingTopWords.java
示例16: main
import backtype.storm.testing.TestWordSpout; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
final int TOP_N = 3;
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 5);
builder.setBolt("count", new RollingCountObjects(60, 10), 4)
.fieldsGrouping("word", new Fields("word"));
builder.setBolt("rank", new RankObjects(TOP_N), 4)
.fieldsGrouping("count", new Fields("obj"));
builder.setBolt("merge", new MergeObjects(TOP_N))
.globalGrouping("rank");
Config conf = new Config();
conf.setDebug(true);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("rolling-demo", conf, builder.createTopology());
Thread.sleep(10000);
cluster.shutdown();
}
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:28,代码来源:RollingTopWords.java
注:本文中的backtype.storm.testing.TestWordSpout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论