本文整理匯總了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;
}
示例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);
}
示例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());
}
示例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);
}
};
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}