backtype.storm.Config.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中backtype.storm.Config.<init>()方法的一些代码示例,展示了Config.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.<init>()方法的具体详情如下:
包路径:backtype.storm.Config
类名称:Config
方法名:<init>

Config.<init>介绍

暂无

代码示例

代码示例来源:origin: alibaba/jstorm

public static Map<String, Object> putTickFrequencyIntoComponentConfig(Map<String, Object> conf, int tickFreqSecs) {
    if (conf == null) {
      conf = new Config();
    }

    if (tickFreqSecs > 0) {
      conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, tickFreqSecs);
    }

    return conf;
  }
}

代码示例来源:origin: alibaba/jstorm

public static List<Object> All_CONFIGS() {
  List<Object> rtn = new ArrayList<>();
  Config config = new Config();
  Class<?> ConfigClass = config.getClass();
  Field[] fields = ConfigClass.getFields();
  for (int i = 0; i < fields.length; i++) {
    try {
      Object obj = fields[i].get(null);
      rtn.add(obj);
    } catch (IllegalArgumentException | IllegalAccessException e) {
      LOG.error(e.getMessage(), e);
    }
  }
  return rtn;
}

代码示例来源:origin: alibaba/jstorm

@Override
public Map<String, Object> getComponentConfiguration() {
  Config conf = new Config();
  conf.setMaxTaskParallelism(1);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

private static Config createTopologyConfiguration() {
  Config conf = new Config();
  conf.setDebug(true);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

@Override
public Map<String, Object> getComponentConfiguration() {
  Config conf = new Config();
  conf.setMaxTaskParallelism(1);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

@Override
  public Map<String, Object> getComponentConfiguration() {
    Config ret = new Config();
    ret.setMaxTaskParallelism(1);
    return ret;
  }
}

代码示例来源:origin: alibaba/jstorm

private static Config createTopologyConfiguration() {
  Config conf = new Config();
  conf.setDebug(true);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

@Override
public Map<String, Object> getComponentConfiguration() {
  Config conf = new Config();
  conf.registerSerialization(MemoryTransactionalSpoutMeta.class);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

@Override
public Map<String, Object> getComponentConfiguration() {
  Config conf = new Config();
  conf.registerSerialization(MemoryTransactionalSpoutMeta.class);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

@Override
public Map<String, Object> getComponentConfiguration() {
  Config ret = new Config();
  ret.setMaxTaskParallelism(1);
  return ret;
}

代码示例来源:origin: alibaba/mdrill

@Override
public Map<String, Object> getComponentConfiguration() {
  Config ret = new Config();
  ret.setMaxTaskParallelism(1);
  return ret;
}

代码示例来源:origin: alibaba/mdrill

@Override
public Map<String, Object> getComponentConfiguration() {
  Config conf = new Config();
  conf.registerSerialization(MemoryTransactionalSpoutMeta.class);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

public static Config getConfig(String[] args) {
  Config ret = new Config();
  if (args == null || args.length == 0) {
    return ret;
  }
  if (StringUtils.isBlank(args[0])) {
    return ret;
  }
  Map conf = JStormHelper.LoadConf(args[0]);
  ret.putAll(conf);
  return ret;
}

代码示例来源:origin: alibaba/jstorm

@Override
public Map<String, Object> getComponentConfiguration() {
  Config ret = new Config();
  ret.setMaxTaskParallelism(1);
  ret.registerSerialization(TransactionAttempt.class);
  return ret;
}

代码示例来源:origin: alibaba/jstorm

public static void run(Config conf, Tool tool, String[] args) {
    try {
      if (conf == null) {
        conf = new Config();
      }

      GenericOptionsParser parser = new GenericOptionsParser(conf, args);
      LOG.info(conf.toString());
      tool.setConf(conf);

      System.exit(tool.run(parser.getRemainingArgs()));
    } catch (ParseException e) {
      LOG.error("Error parsing generic options: {}", e.getMessage());
      GenericOptionsParser.printGenericCommandUsage(System.err);
      System.exit(2);
    } catch (Exception e) {
      LOG.error("Error running tool", e);
      System.exit(1);
    }
  }
}

代码示例来源:origin: alibaba/jstorm

public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
    Map config = new Config();
    config.put(ConfigExtension.TOPOLOGY_MASTER_USER_DEFINED_STREAM_CLASS, "com.alipay.dw.jstorm.example.tm.TMUdfHandler");
    config.put(Config.TOPOLOGY_WORKERS, 2);

    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout("TMUdfSpout", new TMUdfSpout(), 2);
    builder.setBolt("TMUdfBolt", new TMUdfBolt(), 4);
    StormTopology topology = builder.createTopology();

    StormSubmitter.submitTopology("TMUdfTopology", config, topology);
  }
}

代码示例来源:origin: alibaba/jstorm

public static void test() {
  TopologyBuilder builder = new TopologyBuilder();
  
  builder.setSpout("spout", new InOrderSpout(), 8);
  builder.setBolt("count", new Check(), 8).fieldsGrouping("spout", new Fields("c1"));
  
  Config conf = new Config();
  conf.setMaxSpoutPending(20);
  
  String[] className = Thread.currentThread().getStackTrace()[1].getClassName().split("\\.");
  String topologyName = className[className.length - 1];
  
  if (isLocal) {
    drpc = new LocalDRPC();
  }
  
  try {
    JStormHelper.runTopology(buildTopology(drpc), topologyName, conf, 60, new DrpcValidator(), isLocal);
  } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    Assert.fail("Failed");
  }
}

代码示例来源:origin: alibaba/jstorm

public static void test() {
  TopologyBuilder builder = new TopologyBuilder();
  
  builder.setSpout("spout", new RandomSentenceSpout(), 5);
  
  builder.setBolt("split", new SplitSentence(), 8).shuffleGrouping("spout");
  builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word"));
  
  Config conf = new Config();
  conf.setDebug(true);
  
  String[] className = Thread.currentThread().getStackTrace()[1].getClassName().split("\\.");
  String topologyName = className[className.length - 1];
  
  try {
    JStormHelper.runTopology(builder.createTopology(), topologyName, conf, 60,
        new JStormHelper.CheckAckedFail(conf), isLocal);
  } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    Assert.fail("Failed");
  }
}

代码示例来源:origin: alibaba/jstorm

public static void testDrpc() {
  LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
  builder.addBolt(new ExclaimBolt(), 3);
  
  Config conf = new Config();
  
  LocalDRPC drpc = new LocalDRPC();
  LocalCluster cluster = new LocalCluster();
  
  cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
  
  try {
    Thread.sleep(30000);
  } catch (InterruptedException e) {
    // TODO Auto-generated catch block
  }
  try {
    for (String word : new String[] { "hello", "goodbye" }) {
      System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
    }
  } catch (Exception e) {
    e.printStackTrace();
    Assert.fail("Failed to run DRPC Test");
  }
  
  drpc.shutdown();
  cluster.shutdown();
}

代码示例来源:origin: alibaba/jstorm

public static void testDrpc() {
  TopologyBuilder builder = new TopologyBuilder();
  LocalDRPC drpc = new LocalDRPC();
  
  DRPCSpout spout = new DRPCSpout("exclamation", drpc);
  builder.setSpout("drpc", spout);
  builder.setBolt("exclaim", new ExclamationBolt(), 3).shuffleGrouping("drpc");
  builder.setBolt("return", new ReturnResults(), 3).shuffleGrouping("exclaim");
  
  LocalCluster cluster = new LocalCluster();
  Config conf = new Config();
  cluster.submitTopology("exclaim", conf, builder.createTopology());
  
  JStormUtils.sleepMs(30 * 1000);
  
  try {
    System.out.println(drpc.execute("exclamation", "aaa"));
    System.out.println(drpc.execute("exclamation", "bbb"));
  } catch (Exception e) {
    Assert.fail("Failed to test drpc");
  }
  
  drpc.shutdown();
  cluster.shutdown();
}

相关文章