當前位置: 首頁>>代碼示例>>Java>>正文


Java IRichBolt類代碼示例

本文整理匯總了Java中backtype.storm.topology.IRichBolt的典型用法代碼示例。如果您正苦於以下問題:Java IRichBolt類的具體用法?Java IRichBolt怎麽用?Java IRichBolt使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IRichBolt類屬於backtype.storm.topology包,在下文中一共展示了IRichBolt類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setBolt

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Override
public BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelismHint) {
	if(callSuper) {
		return super.setBolt(id, bolt, parallelismHint);
	}
	
	if(this.meassureThroughput) {
		bolt = new ThroughputBolt(bolt, this.reportingInterval);
	}
	if(this.meassureLatency) {
		bolt = new LatencyBolt(bolt);
	}
	bolt = new InputDebatcher(bolt);
	
	BoltDeclarer declarer = super.setBolt(id, bolt, parallelismHint);
	
	if(this.meassureThroughput) {
		this.callSuper = true;
		setBolt(id + "Stats", new FileFlushSinkBolt(DEFAULT_STATS_DIR + File.separator + id + ".throughput"))
			.shuffleGrouping(id, MonitoringTopoloyBuilder.DEFAULT_THROUGHPUT_STREAM);
		this.callSuper = false;
	}
	
	return declarer;
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:26,代碼來源:MonitoringTopoloyBuilder.java

示例2: prepareStatic

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@BeforeClass
public static void prepareStatic() {
	final long seed = System.currentTimeMillis();
	Random r = new Random(seed);
	System.out.println("Static test seed: " + seed);
	
	tsIndex = r.nextInt();
	if(tsIndex < 0) {
		tsIndex *= -1;
	}
	
	duplicates = r.nextBoolean();
	
	boltMockStatic = mock(IRichBolt.class);
	when(boltMockStatic.getComponentConfiguration()).thenReturn(boltConfig);
	
	checker = new TimestampOrderChecker(boltMockStatic, tsIndex, duplicates);
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:19,代碼來源:TimestampMergerTest.java

示例3: testSetBoltPrallelismBatchSize

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Test
public void testSetBoltPrallelismBatchSize() {
	IRichBolt userBolt = new TestBolt();
	final Integer dop = new Integer(1 + this.r.nextInt(5));
	final int batchSize = this.r.nextInt(10);
	
	if(batchSize > 0) {
		this.topologyBuilder.setBolt(this.bolt1, new BoltOutputBatcher(new InputDebatcher(userBolt), batchSize),
			dop);
	} else {
		this.topologyBuilder.setBolt(this.bolt1, new BoltOutputBatcher(new InputDebatcher(userBolt),
			this.noBatching), dop);
	}
	this.aeolusBuilder.setBolt(this.bolt1, userBolt, dop, batchSize);
	
	Assert.assertEquals(this.topologyBuilder.createTopology(), this.aeolusBuilder.createTopology());
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:18,代碼來源:AeolusBuilderTest.java

示例4: testAddToTopology

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Test
public void testAddToTopology() {
  new Expectations() {
    {
      topology.getStormBuilder();
      result = stormBuilder;

      stormBuilder.setBolt(ID, (IRichBolt) any, anyInt);
      result = new MockUp<BoltDeclarer>() {
      }.getMockInstance();
    }
  };

  pi.addToTopology(topology, PARRALLELISM_HINT_4); // this parallelism hint is ignored

  new Verifications() {
    {
      assertEquals(pi.getProcessor(), processor);
      // TODO add methods to explore a topology and verify them
      assertEquals(pi.getParallelism(), PARRALLELISM_HINT_2);
      assertEquals(pi.getId(), ID);
    }
  };
}
 
開發者ID:apache,項目名稱:incubator-samoa,代碼行數:25,代碼來源:StormProcessingItemTest.java

示例5: addBolt

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Deprecated
public LinearDRPCInputDeclarer addBolt(IRichBolt bolt, Number parallelism) {
	if (parallelism == null)
		parallelism = 1;
	Component component = new Component(bolt, parallelism.intValue());
	_components.add(component);
	return new InputDeclarerImpl(component);
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:9,代碼來源:LinearDRPCTopologyBuilder.java

示例6: setBolt

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
private BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelism) {
	Integer p = null;
	if (parallelism != null)
		p = parallelism.intValue();
	Component component = new Component(bolt, p);
	_bolts.put(id, component);
	return new BoltDeclarerImpl(component);
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:9,代碼來源:BatchSubtopologyBuilder.java

示例7: CoordinatedBolt

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
public CoordinatedBolt(IRichBolt delegate,
		Map<String, SourceArgs> sourceArgs, IdStreamSpec idStreamSpec) {
	_sourceArgs = sourceArgs;
	if (_sourceArgs == null)
		_sourceArgs = new HashMap<String, SourceArgs>();
	_delegate = delegate;
	_idStreamSpec = idStreamSpec;
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:9,代碼來源:CoordinatedBolt.java

示例8: setBolt

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
private BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelism,
		boolean committer) {
	Integer p = null;
	if (parallelism != null)
		p = parallelism.intValue();
	Component component = new Component(bolt, p, committer);
	_bolts.put(id, component);
	return new BoltDeclarerImpl(component);
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:10,代碼來源:TransactionalTopologyBuilder.java

示例9: setSink

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
public BoltDeclarer setSink(String id, IRichBolt bolt, Number parallelismHint) {
	if(this.meassureThroughput) {
		bolt = new ThroughputBolt(bolt, this.reportingInterval, true);
	}
	if(this.meassureLatency) {
		bolt = new LatencyCollectorBolt(bolt, this.statsBucketSize);
	}
	bolt = new InputDebatcher(bolt);
	
	final BoltDeclarer declarer = super.setBolt(id, bolt, parallelismHint);
	
	if(this.meassureThroughput) {
		this.callSuper = true;
		setBolt(id + "Stats", new FileFlushSinkBolt(DEFAULT_STATS_DIR + File.separator + id + ".throughput"))
			.shuffleGrouping(id, MonitoringTopoloyBuilder.DEFAULT_THROUGHPUT_STREAM);
		this.callSuper = false;
	}
	
	if(this.meassureLatency) {
		this.callSuper = true;
		setBolt(id + "LatencyStats", new FileFlushSinkBolt(DEFAULT_STATS_DIR + File.separator + id + ".latencies"))
			.shuffleGrouping(id, MonitoringTopoloyBuilder.DEFAULT_LATENCY_STREAM);
		this.callSuper = false;
	}
	
	return declarer;
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:28,代碼來源:MonitoringTopoloyBuilder.java

示例10: TimestampMerger

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
/**
 * Instantiates a new {@link TimestampMerger} that wrapped the given bolt.
 * 
 * @param wrappedBolt
 *            The bolt to be wrapped.
 * @param tsIndex
 *            The index of the timestamp attribute.
 */
public TimestampMerger(IRichBolt wrappedBolt, int tsIndex) {
	assert (wrappedBolt != null);
	assert (tsIndex >= 0);
	
	logger.debug("Initialize with timestamp index {}", new Integer(tsIndex));
	
	this.wrappedBolt = wrappedBolt;
	this.tsIndex = tsIndex;
	this.tsAttributeName = null;
	this.tsExtractor = null;
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:20,代碼來源:TimestampMerger.java

示例11: prepareTestStatic

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@BeforeClass
public static void prepareTestStatic() {
	PowerMockito.mockStatic(LoggerFactory.class);
	when(LoggerFactory.getLogger(any(Class.class))).thenReturn(loggerMockStatic);
	
	loggerMockStatic = mock(Logger.class);
	
	PowerMockito.mockStatic(LoggerFactory.class);
	when(LoggerFactory.getLogger(any(Class.class))).thenReturn(loggerMockStatic);
	
	boltMockStatic = mock(IRichBolt.class);
	when(boltMockStatic.getComponentConfiguration()).thenReturn(boltConfigStatic);
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:14,代碼來源:TimestampOrderCheckerTest.java

示例12: testSetBoltSimple

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Test
public void testSetBoltSimple() {
	IRichBolt userBolt = new TestBolt();
	
	this.topologyBuilder.setBolt(this.bolt1, new BoltOutputBatcher(new InputDebatcher(userBolt), this.noBatching));
	this.aeolusBuilder.setBolt(this.bolt1, userBolt);
	
	Assert.assertEquals(this.topologyBuilder.createTopology(), this.aeolusBuilder.createTopology());
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:10,代碼來源:AeolusBuilderTest.java

示例13: testSetBoltBatchSize

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Test
public void testSetBoltBatchSize() {
	IRichBolt userBolt = new TestBolt();
	final int batchSize = this.r.nextInt(10);
	
	if(batchSize > 0) {
		this.topologyBuilder.setBolt(this.bolt1, new BoltOutputBatcher(new InputDebatcher(userBolt), batchSize));
	} else {
		this.topologyBuilder.setBolt(this.bolt1, new BoltOutputBatcher(new InputDebatcher(userBolt),
			this.noBatching));
	}
	this.aeolusBuilder.setBolt(this.bolt1, userBolt, batchSize);
	
	Assert.assertEquals(this.topologyBuilder.createTopology(), this.aeolusBuilder.createTopology());
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:16,代碼來源:AeolusBuilderTest.java

示例14: testSetBoltBatchSizes

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Test
public void testSetBoltBatchSizes() {
	IRichBolt userBolt = new TestBolt();
	HashMap<String, Integer> batchSizes = new HashMap<String, Integer>();
	
	this.topologyBuilder.setBolt(this.bolt1, new BoltOutputBatcher(new InputDebatcher(userBolt), batchSizes));
	this.aeolusBuilder.setBolt(this.bolt1, userBolt, batchSizes);
	
	Assert.assertEquals(this.topologyBuilder.createTopology(), this.aeolusBuilder.createTopology());
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:11,代碼來源:AeolusBuilderTest.java

示例15: testSetBoltPrallelism

import backtype.storm.topology.IRichBolt; //導入依賴的package包/類
@Test
public void testSetBoltPrallelism() {
	IRichBolt userBolt = new TestBolt();
	final Integer dop = new Integer(1 + this.r.nextInt(5));
	
	this.topologyBuilder.setBolt(this.bolt1, new BoltOutputBatcher(new InputDebatcher(userBolt), this.noBatching),
		dop);
	this.aeolusBuilder.setBolt(this.bolt1, userBolt, dop);
	
	Assert.assertEquals(this.topologyBuilder.createTopology(), this.aeolusBuilder.createTopology());
}
 
開發者ID:mjsax,項目名稱:aeolus,代碼行數:12,代碼來源:AeolusBuilderTest.java


注:本文中的backtype.storm.topology.IRichBolt類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。