本文整理汇总了Java中storm.trident.spout.ITridentSpout类的典型用法代码示例。如果您正苦于以下问题:Java ITridentSpout类的具体用法?Java ITridentSpout怎么用?Java ITridentSpout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ITridentSpout类属于storm.trident.spout包,在下文中一共展示了ITridentSpout类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildTopology
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
public static StormTopology buildTopology(Config conf) {
ITridentSpout<Object> spout;
if (!ConfigUtil.getBoolean(conf, "spout.redis", false)) {
spout = new OneSentencePerBatchSpout();
} else {
String host = (String) conf.get("redis.host");
int port = ((Number) conf.get("redis.port")).intValue();
String queue = (String) conf.get("redis.queue");
spout = null;
}
TridentTopology topology = new TridentTopology();
topology.newStream("spout", spout).parallelismHint(ConfigUtil.getInt(conf, "spout.parallelism", 1))
.each(new Fields("sentence"), new Split(), new Fields("word"))
.parallelismHint(ConfigUtil.getInt(conf, "split.parallelism", 1))
.groupBy(new Fields("word"))
.persistentAggregate(new MemoryMapState.Factory(), new Count(), new Fields("count"))
.parallelismHint(ConfigUtil.getInt(conf, "counter.parallelism", 1));
return topology.build();
}
示例2: setSpout
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
public SpoutDeclarer setSpout(String id, String streamName, String txStateId, ITridentSpout spout, Integer parallelism, String batchGroup) {
Map<String, String> batchGroups = new HashMap();
batchGroups.put(streamName, batchGroup);
markBatchGroups(id, batchGroups);
TransactionalSpoutComponent c = new TransactionalSpoutComponent(spout, streamName, parallelism, txStateId, batchGroup);
_spouts.put(id, c);
return new SpoutDeclarerImpl(c);
}
示例3: MasterBatchCoordinator
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
public MasterBatchCoordinator(List<String> spoutIds, List<ITridentSpout> spouts) {
if(spoutIds.isEmpty()) {
throw new IllegalArgumentException("Must manage at least one spout");
}
_managedSpoutIds = spoutIds;
_spouts = spouts;
}
示例4: isReady
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
private boolean isReady(long txid) {
//: make this strategy configurable?... right now it goes if anyone is ready
for(ITridentSpout.BatchCoordinator coord: _coordinators) {
if(coord.isReady(txid)) return true;
}
return false;
}
示例5: getSpoutComponentConfig
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
private static Map getSpoutComponentConfig(Object spout) {
if(spout instanceof IRichSpout) {
return ((IRichSpout) spout).getComponentConfiguration();
} else if (spout instanceof IBatchSpout) {
return ((IBatchSpout) spout).getComponentConfiguration();
} else {
return ((ITridentSpout) spout).getComponentConfiguration();
}
}
示例6: isReady
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
private boolean isReady(long txid) {
//TODO: make this strategy configurable?... right now it goes if anyone is ready
for(ITridentSpout.BatchCoordinator coord: _coordinators) {
if(coord.isReady(txid)) return true;
}
return false;
}
示例7: getCoordinator
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
/**
* The coordinator for a TransactionalSpout runs in a single thread and indicates when batches
* of tuples should be emitted and when transactions should commit. The Coordinator that you provide
* in a TransactionalSpout provides metadata for each transaction so that the transactions can be replayed.
*/
@Override
public storm.trident.spout.ITridentSpout.BatchCoordinator<Object> getCoordinator(
String arg0, Map arg1, TopologyContext arg2) {
// TODO Auto-generated method stub
return coordinator;
}
示例8: getEmitter
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
/**
* The emitter for a TransactionalSpout runs as many tasks across the cluster. Emitters are responsible for
* emitting batches of tuples for a transaction and must ensure that the same batch of tuples is always
* emitted for the same transaction id.
*/
@Override
public storm.trident.spout.ITridentSpout.Emitter<Object> getEmitter(
String arg0, Map arg1, TopologyContext arg2) {
// TODO Auto-generated method stub
return emitter;
}
示例9: getEmitter
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
/**
* The emitter for a TransactionalSpout runs as many tasks across the cluster. Emitters are responsible for
* emitting batches of tuples for a transaction and must ensure that the same batch of tuples is always
* emitted for the same transaction id.
*/
@Override
public storm.trident.spout.ITridentSpout.Emitter<Object> getEmitter(
String arg0, Map conf, TopologyContext arg2) {
// TODO Auto-generated method stub
String currentThreadName = Thread.currentThread().getName();
CommonUtil.logMessage(logger, currentThreadName, "getEmitter: entered with conf = %s", conf);
Integer phraseCount = Integer.parseInt((String)conf.get("phraseCount"));
emitter = new RandomPhraseEmitter(phraseCount);
return emitter;
}
示例10: getCoordinator
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
/**
* The coordinator for a TransactionalSpout runs in a single thread and indicates when batches
* of tuples should be emitted and when transactions should commit. The Coordinator that you provide
* in a TransactionalSpout provides metadata for each transaction so that the transactions can be replayed.
*/
@Override
public storm.trident.spout.ITridentSpout.BatchCoordinator<String> getCoordinator(
String arg0, Map arg1, TopologyContext arg2) {
// TODO Auto-generated method stub
return coordinator;
}
示例11: getEmitter
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
/**
* The emitter for a TransactionalSpout runs as many tasks across the cluster. Emitters are responsible for
* emitting batches of tuples for a transaction and must ensure that the same batch of tuples is always
* emitted for the same transaction id.
*/
@Override
public storm.trident.spout.ITridentSpout.Emitter<String> getEmitter(
String arg0, Map conf, TopologyContext arg2) {
// TODO Auto-generated method stub
String currentThreadName = Thread.currentThread().getName();
CommonUtil.logMessage(logger, currentThreadName, "getEmitter: entered with conf = %s", conf);
Integer phraseCount = Integer.parseInt((String)conf.get("phraseCount"));
String redisServerIP = (String)conf.get("redisServerIP");
String redisServerPort = (String)conf.get("redisServerPort");
emitter = new RandomPhraseEmitter(phraseCount, redisServerIP, redisServerPort);
return emitter;
}
示例12: getEmitter
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
/**
* The emitter for a TransactionalSpout runs as many tasks across the cluster. Emitters are responsible for
* emitting batches of tuples for a transaction and must ensure that the same batch of tuples is always
* emitted for the same transaction id.
*/
@Override
public storm.trident.spout.ITridentSpout.Emitter<String> getEmitter(
String arg0, Map conf, TopologyContext arg2) {
// TODO Auto-generated method stub
String currentThreadName = Thread.currentThread().getName();
CommonUtil.logMessage(logger, currentThreadName, "getEmitter: entered with conf = %s", conf);
String redisServerIP = (String)conf.get("redisServerIP");
String redisServerPort = (String)conf.get("redisServerPort");
emitter = new RandomPhraseEmitter(redisServerIP, redisServerPort);
return emitter;
}
示例13: isReady
import storm.trident.spout.ITridentSpout; //导入依赖的package包/类
private boolean isReady(long txid) {
if(_throttler.isThrottled()) return false;
//TODO: make this strategy configurable?... right now it goes if anyone is ready
for(ITridentSpout.BatchCoordinator coord: _coordinators) {
if(coord.isReady(txid)) return true;
}
return false;
}