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


Java BaseRichSpout类代码示例

本文整理汇总了Java中backtype.storm.topology.base.BaseRichSpout的典型用法代码示例。如果您正苦于以下问题:Java BaseRichSpout类的具体用法?Java BaseRichSpout怎么用?Java BaseRichSpout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: buildWithSpout

import backtype.storm.topology.base.BaseRichSpout; //导入依赖的package包/类
public static StormTopology buildWithSpout(String spoutId, BaseRichSpout spout) {
  TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout(spoutId, spout);
  builder.setBolt(GEOCODE_LOOKUP_ID, new GeocodeLookup()).shuffleGrouping(spoutId);
  builder.setBolt(HEATMAP_BUILDER_ID, new HeatMapBuilder())
      .addConfiguration(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 3).globalGrouping(GEOCODE_LOOKUP_ID);
  builder.setBolt(PERSISTOR_ID, new Persistor()).shuffleGrouping(HEATMAP_BUILDER_ID);
  return builder.createTopology();
}
 
开发者ID:Storm-Applied,项目名称:C3-Heatmap,代码行数:10,代码来源:StormTopologyBuilder.java

示例2: createTopology

import backtype.storm.topology.base.BaseRichSpout; //导入依赖的package包/类
public static StormTopology createTopology(XMLConfiguration config) {

	String redisHost = config.getString("redis.hostname", "localhost");
	String itemsChannel = config.getString("redis.itemsChannel", "items");
	
	String nerModel = config.getString("ner.model", "english.all.3class.distsim.crf.ser.gz");
	String POSModel = config.getString("pos.model", "english-left3words-distsim.tagger");
	
	BaseRichSpout itemsSpout;
	IRichBolt entityExtractor, posTagger;
	IRichBolt itemDeserializer, tokenizer, eventDetector;	
	try {
		itemsSpout = new RedisSpout(redisHost, itemsChannel);
		itemDeserializer = new ItemDeserializationBolt(itemsChannel);

		entityExtractor = new EntityExtractionBolt(nerModel);
		posTagger = new POSTaggingBolt(POSModel);
		
		tokenizer = new TokenizationBolt(TokenizationBolt.TokenType.NE);
		
		eventDetector = new EventDetectionBolt(5, 60);
		
	} catch (Exception e) {
		logger.error(e);
		return null;
	}
	
	// Create topology 
	TopologyBuilder builder = new TopologyBuilder();
	builder.setSpout("itemsSpout", itemsSpout, 1);
			
	builder.setBolt("itemDeserializer", itemDeserializer, 4).shuffleGrouping("itemsSpout");
	builder.setBolt("entityExtractor", entityExtractor, 4).shuffleGrouping("itemDeserializer");
	//builder.setBolt("posTagger", posTagger, 4).shuffleGrouping("entityExtractor");
	builder.setBolt("tokenizer", tokenizer, 8).shuffleGrouping("entityExtractor");
	
	builder.setBolt("eventDetector", eventDetector, 1).shuffleGrouping("tokenizer");
	
	StormTopology topology = builder.createTopology();
	return topology;
}
 
开发者ID:socialsensor,项目名称:storm-focused-crawler,代码行数:42,代码来源:StreamMonitor.java

示例3: createTopology

import backtype.storm.topology.base.BaseRichSpout; //导入依赖的package包/类
public static StormTopology createTopology(XMLConfiguration config) {

	String redisHost = config.getString("redis.hostname", "xxx.xxx.xxx.xxx");
	String webPagesChannel = config.getString("redis.webPagesChannel", "webpages");
	
	String mongodbHostname = config.getString("mongodb.hostname", "xxx.xxx.xxx.xxx");
	String mediaItemsDB = config.getString("mongodb.mediaItemsDB", "Prototype");
	String mediaItemsCollection = config.getString("mongodb.mediaItemsCollection", "MediaItems");
	String streamUsersDB = config.getString("mongodb.streamUsersDB", "Prototype");
	String streamUsersCollection = config.getString("mongodb.streamUsersCollection", "StreamUsers");
	String webPagesDB = config.getString("mongodb.webPagesDB", "Prototype");
	String webPagesCollection = config.getString("mongodb.webPagesCollection", "WebPages");
	
	String textIndexHostname = config.getString("textindex.hostname", "xxx.xxx.xxx.xxx:8080/solr");
	String textIndexCollection = config.getString("textindex.collections.webpages", "WebPages");
	String mediaIndexCollection = config.getString("textindex.collections.media", "MediaItems");
	String textIndexService = textIndexHostname + "/" + textIndexCollection;
	String mediaTextIndexService = textIndexHostname + "/" + mediaIndexCollection;
	
	BaseRichSpout wpSpout;
	IRichBolt wpDeserializer, mediaUpdater, urlExpander, mediaTextIndexer;
	IRichBolt articleExtraction, mediaExtraction, webPageUpdater, textIndexer;
	
	try {
		wpSpout = new RedisSpout(redisHost, webPagesChannel, "url");
		wpDeserializer = new WebPageDeserializationBolt(webPagesChannel);
		urlExpander = new URLExpansionBolt(webPagesChannel);
		
		articleExtraction = new ArticleExtractionBolt(24);
		mediaExtraction = new MediaExtractionBolt();
		webPageUpdater = new WebPagesUpdaterBolt(mongodbHostname, webPagesDB, webPagesCollection);
		textIndexer = new TextIndexerBolt(textIndexService);

		mediaUpdater = new MediaUpdaterBolt(mongodbHostname, mediaItemsDB, mediaItemsCollection, streamUsersDB, streamUsersCollection);
		mediaTextIndexer = new MediaTextIndexerBolt(mediaTextIndexService);
	} catch (Exception e) {
		logger.error(e);
		return null;
	}
	
	// Create topology 
	TopologyBuilder builder = new TopologyBuilder();
	builder.setSpout("wpSpout", wpSpout, 1);
			
	builder.setBolt("WpDeserializer", wpDeserializer, 4).shuffleGrouping("wpSpout");
	builder.setBolt("expander", urlExpander, 8).shuffleGrouping("WpDeserializer");
			
			
	builder.setBolt("articleExtraction", articleExtraction, 1)
		.shuffleGrouping("expander", "webpage");
	builder.setBolt("mediaExtraction", mediaExtraction, 1)
		.shuffleGrouping("expander", "media");
			
	builder.setBolt("webPageUpdater", webPageUpdater, 4)
		.shuffleGrouping("articleExtraction", "webpage")
		.shuffleGrouping("mediaExtraction", "webpage");
			
	builder.setBolt("textIndexer", textIndexer, 1)
		.shuffleGrouping("articleExtraction", "webpage");
			
	builder.setBolt("mediaupdater", mediaUpdater, 1)
		.shuffleGrouping("articleExtraction", "media")
		.shuffleGrouping("mediaExtraction", "media");
	
	builder.setBolt("mediatextindexer", mediaTextIndexer, 1)
		.shuffleGrouping("articleExtraction", "media")
		.shuffleGrouping("mediaExtraction", "media");
	
	StormTopology topology = builder.createTopology();
	return topology;
}
 
开发者ID:socialsensor,项目名称:storm-focused-crawler,代码行数:72,代码来源:WikirateCrawler.java

示例4: createTopology

import backtype.storm.topology.base.BaseRichSpout; //导入依赖的package包/类
public static StormTopology createTopology(XMLConfiguration config) {
	
	String redisHost = config.getString("redis.hostname", "xxx.xxx.xxx.xxx");
	String redisMediaChannel = config.getString("redis.mediaItemsChannel", "media");
	
	String mongodbHostname = config.getString("mongodb.hostname", "xxx.xxx.xxx.xxx");
	String mediaItemsDB = config.getString("mongodb.mediaItemsDB", "Prototype");
	String mediaItemsCollection = config.getString("mongodb.mediaItemsCollection", "MediaItems");
	String streamUsersDB = config.getString("mongodb.streamUsersDB", "Prototype");
	String streamUsersCollection = config.getString("mongodb.streamUsersCollection", "StreamUsers");
	String clustersDB = config.getString("mongodb.clustersDB", "Prototype");
	String clustersCollection = config.getString("mongodb.clustersCollection", "MediaClusters");
	
	String conceptDetectorMatlabfile = config.getString("conceptdetector.matlabfile");
	
	String mediaTextIndexHostname = config.getString("textindex.hostname", "http://xxx.xxx.xxx.xxx:8080/solr");
	String mediaTextIndexCollection = config.getString("textindex.collections.media", "MediaItems");
	String mediaTextIndexService = mediaTextIndexHostname + "/" + mediaTextIndexCollection;
	
	String visualIndexHostname = config.getString("visualindex.hostname");
	String visualIndexCollection = config.getString("visualindex.collection");
	
	String learningFiles = config.getString("visualindex.learningfiles");
	if(!learningFiles.endsWith("/"))
		learningFiles = learningFiles + "/";
	
	String[] codebookFiles = { 
			learningFiles + "surf_l2_128c_0.csv",
			learningFiles + "surf_l2_128c_1.csv", 
			learningFiles + "surf_l2_128c_2.csv",
			learningFiles + "surf_l2_128c_3.csv" };
	
	String pcaFile = learningFiles + "pca_surf_4x128_32768to1024.txt";
	
	BaseRichSpout miSpout;
	IRichBolt miRanker, mediaCounter, visualIndexer, mediaUpdater, conceptDetector;
	IRichBolt mediaTextIndexer, clusterer;
	
	try {
		miSpout = new RedisSpout(redisHost, redisMediaChannel, "id");	
		miRanker = new MediaRankerBolt(redisMediaChannel);
		
		mediaCounter = new MediaCounterBolt(mongodbHostname, "Prototype");
		visualIndexer = new VisualIndexerBolt(visualIndexHostname, visualIndexCollection, codebookFiles, pcaFile);
		clusterer = new ClustererBolt(mongodbHostname, mediaItemsDB, mediaItemsCollection, clustersDB, clustersCollection, visualIndexHostname, visualIndexCollection, mediaTextIndexService);
		conceptDetector = new ConceptDetectionBolt(conceptDetectorMatlabfile);
		
		mediaUpdater = new MediaUpdaterBolt(mongodbHostname, mediaItemsDB, mediaItemsCollection, streamUsersDB, streamUsersCollection);
		mediaTextIndexer = new MediaTextIndexerBolt(mediaTextIndexService);
	} catch (Exception e) {
		logger.error(e);
		return null;
	}
	
	// Create topology 
	TopologyBuilder builder = new TopologyBuilder();
	builder.setSpout("miInjector", miSpout, 1);
			
	builder.setBolt("miRanker", miRanker, 4).shuffleGrouping("miInjector");

	builder.setBolt("counter", mediaCounter, 1).shuffleGrouping("miRanker");
	builder.setBolt("indexer", visualIndexer, 16).shuffleGrouping("miRanker");
	builder.setBolt("clusterer", clusterer, 1).shuffleGrouping("indexer");   
	builder.setBolt("conceptDetector", conceptDetector, 1).shuffleGrouping("indexer");
	        
	builder.setBolt("mediaupdater", mediaUpdater, 1).shuffleGrouping("conceptDetector");
	builder.setBolt("mediaTextIndexer", mediaTextIndexer, 1).shuffleGrouping("conceptDetector");
	
	return builder.createTopology();
}
 
开发者ID:socialsensor,项目名称:storm-focused-crawler,代码行数:71,代码来源:VisualIndexer.java


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