本文整理汇总了Java中org.apache.storm.Config.setMessageTimeoutSecs方法的典型用法代码示例。如果您正苦于以下问题:Java Config.setMessageTimeoutSecs方法的具体用法?Java Config.setMessageTimeoutSecs怎么用?Java Config.setMessageTimeoutSecs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.storm.Config
的用法示例。
在下文中一共展示了Config.setMessageTimeoutSecs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.apache.storm.Config; //导入方法依赖的package包/类
private void start(StormTopology topology, boolean runAsLocal) throws Exception {
Config conf = new Config();
conf.put(Constants.StormConfigKey.FULL_SPLITTER_TOPOLOGY_ID, fullSplitterTopologyId);
conf.put(Constants.StormConfigKey.FULL_PULLER_TOPOLOGY_ID, fullPullerTopologyId);
conf.put(Constants.StormConfigKey.ZKCONNECT, this.zkConnect);
conf.setMessageTimeoutSecs(3600);
conf.setMaxSpoutPending(30);
conf.setDebug(true);
conf.setNumWorkers(1);
if (runAsLocal) {
conf.setMaxTaskParallelism(3);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(topologyName, conf, topology);
} else {
StormSubmitter.submitTopology(topologyName, conf, topology);
}
}
示例2: run
import org.apache.storm.Config; //导入方法依赖的package包/类
protected void run() {
Config config = new Config();
config.setNumWorkers(2);
config.setMessageTimeoutSecs(120);
try {
StormSubmitter.submitTopology(builder.getTopologyName(), config, builder.build());
} catch (AlreadyAliveException | InvalidTopologyException | AuthorizationException e) {
String message = "could not submit topology" + builder.getTopologyName();
logger.error(message, e);
throw new StormException(message, e);
}
}
示例3: buildTopology
import org.apache.storm.Config; //导入方法依赖的package包/类
public void buildTopology (String[] args){
//TODO
if (parseCommandArgs(args) != 0) {
return;
}
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("CanalClientSpout", new CanalClientSpout(), 1);
builder.setBolt("KafkaProducerBolt", new KafkaProducerBolt(), 1).shuffleGrouping("CanalClientSpout");
Config conf = new Config();
conf.put(Constants.ZOOKEEPER_SERVERS, zkServers);
conf.put(Constants.EXTRACTOR_TOPOLOGY_ID, extractorTopologyId);
logger.info(Constants.ZOOKEEPER_SERVERS + "=" + zkServers);
logger.info(Constants.EXTRACTOR_TOPOLOGY_ID + "=" + extractorTopologyId);
conf.setNumWorkers(1);
conf.setMessageTimeoutSecs(60);
if (!runAsLocal) {
conf.setDebug(false);
try {
//StormSubmitter.submitTopology("extractorTopologyId", conf, builder.createTopology());
StormSubmitter.submitTopology(extractorTopologyId, conf, builder.createTopology());
} catch (Exception e) {
e.printStackTrace();
}
} else {
conf.setDebug(false);
LocalCluster cluster = new LocalCluster();
//cluster.submitTopology("extractorTopologyId", conf, builder.createTopology());
cluster.submitTopology(extractorTopologyId, conf, builder.createTopology());
}
}
示例4: main
import org.apache.storm.Config; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
int parallelism = 2;
int spouts = parallelism;
builder.setSpout("word", new TestWordSpout(Duration.ofMillis(50)), spouts);
int bolts = 2 * parallelism;
builder.setBolt("exclaim1", new ExclamationBolt(), bolts)
.shuffleGrouping("word");
Config conf = new Config();
conf.setDebug(true);
conf.setMaxSpoutPending(10);
conf.setMessageTimeoutSecs(600);
conf.put(Config.TOPOLOGY_WORKER_CHILDOPTS, "-XX:+HeapDumpOnOutOfMemoryError");
if (args != null && args.length > 0) {
conf.setNumWorkers(parallelism);
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} else {
System.out.println("Topology name not provided as an argument, running in simulator mode.");
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
Utils.sleep(10000);
cluster.killTopology("test");
cluster.shutdown();
}
}
示例5: start
import org.apache.storm.Config; //导入方法依赖的package包/类
private void start(StormTopology topology, boolean runAsLocal) throws Exception {
Config conf = new Config();
// 启动类型为all,或者dispatcher
if(topologyType.equals(Constants.TopologyType.ALL) || topologyType.equals(Constants.TopologyType.DISPATCHER)) {
/**
* dispatcher配置
*/
conf.put(com.creditease.dbus.commons.Constants.ZOOKEEPER_SERVERS, zookeeper);
conf.put(com.creditease.dbus.commons.Constants.TOPOLOGY_ID, dispatcherTopologyId);
logger.info(com.creditease.dbus.commons.Constants.ZOOKEEPER_SERVERS + "=" + zookeeper);
logger.info(com.creditease.dbus.commons.Constants.TOPOLOGY_ID + "=" + dispatcherTopologyId);
}
// 启动类型为all,或者appender
if (topologyType.equals(Constants.TopologyType.ALL) || topologyType.equals(Constants.TopologyType.APPENDER)) {
/**
* appender配置
*/
// 初始化配置文件
this.initialize(zookeeper, Constants.ZKPath.ZK_TOPOLOGY_ROOT + "/" + appenderTopologyId);
conf.put(Constants.StormConfigKey.TOPOLOGY_ID, appenderTopologyId);
conf.put(Constants.StormConfigKey.ZKCONNECT, zookeeper);
conf.put(Constants.StormConfigKey.DATASOURCE, datasource);
}
conf.setDebug(true);
//设置worker数
conf.setNumWorkers(1);
//设置任务在发出后,但还没处理完成的中间状态任务的最大数量
conf.setMaxSpoutPending(100);
//设置任务在多久之内没处理完成,就任务这个任务处理失败
conf.setMessageTimeoutSecs(120);
if (runAsLocal) {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(topologyId, conf, topology);
/*String cmd;
do {
cmd = System.console().readLine();
} while (!cmd.equals("exit"));
cluster.shutdown();*/
} else {
StormSubmitter.submitTopology(topologyId, conf, topology);
}
}
示例6: main
import org.apache.storm.Config; //导入方法依赖的package包/类
public static void main( String[] args ) throws Exception {
String propertiesFile = DEFAULT_PROPERTIES_FILE;
if (args != null && args.length == 1 && args[0] != null) {
propertiesFile = args[0];
}
LogLevelCountProperties props = new LogLevelCountProperties(propertiesFile);
int windowMillis = props.getStormWindowMillis();
double rateThreshold = props.getStormRateThreshold();
// Build the spout for pulling data from NiFi and pull out the log level into a tuple field
NiFiSpout niFiSpout = new NiFiSpout(getSourceConfig(props), Collections.singletonList(props.getLogLevelAttribute()));
// Build the bolt for counting log levels over a tumbling window
BaseWindowedBolt logLevelWindowBolt = new LogLevelWindowBolt(props.getLogLevelAttribute())
.withTumblingWindow(new BaseWindowedBolt.Duration(windowMillis, TimeUnit.MILLISECONDS));
// Build the bolt for pushing results back to NiFi
NiFiDataPacketBuilder dictionaryBuilder = new DictionaryBuilder(windowMillis, rateThreshold);
NiFiBolt niFiBolt = new NiFiBolt(getSinkConfig(props), dictionaryBuilder, 10).withBatchSize(1);
// Build the topology of NiFiSpout -> LogLevelWindowBolt -> NiFiBolt
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("nifiInput", niFiSpout);
builder.setBolt("logLevels", logLevelWindowBolt).shuffleGrouping("nifiInput");
builder.setBolt("nifiOutput", niFiBolt).shuffleGrouping("logLevels");
// Submit the topology
Config conf = new Config();
conf.setDebug(true);
// Need to set the message timeout to twice the window size in seconds
conf.setMessageTimeoutSecs((props.getStormWindowMillis()/1000) * 2);
if (args != null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
}
else {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("log-levels", conf, builder.createTopology());
Utils.sleep(130000);
cluster.killTopology("log-levels");
cluster.shutdown();
}
}
示例7: getConfig
import org.apache.storm.Config; //导入方法依赖的package包/类
protected Config getConfig() {
Config config = new Config();
config.setDebug(true);
config.setMessageTimeoutSecs((WINDOW_SIZE_MS/1000) * 2);
return config;
}