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


Java ITridentSpout类代码示例

本文整理汇总了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();
}
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:20,代码来源:TridentWordCount.java

示例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);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:TridentTopologyBuilder.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:MasterBatchCoordinator.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:MasterBatchCoordinator.java

示例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();
    }
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:TridentTopology.java

示例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;
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:8,代码来源:MasterBatchCoordinator.java

示例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;
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:13,代码来源:RandomWordSpout.java

示例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;
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:13,代码来源:RandomWordSpout.java

示例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;
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:17,代码来源:RandomPhraseSpout.java

示例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;
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:13,代码来源:RandomPhraseSpout.java

示例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;
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:19,代码来源:RandomPhraseSpout.java

示例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;
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:18,代码来源:RandomPhraseSpout.java

示例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;
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:9,代码来源:MasterBatchCoordinator.java


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