예제 #1
0
 public NewKafkaConnector(String brokerList, ConfigLoader cl) {
   Properties props = new Properties();
   props.setProperty(ProducerConfig.REQUIRED_ACKS_CONFIG, "1");
   props.setProperty(ProducerConfig.BROKER_LIST_CONFIG, brokerList);
   props.setProperty(ProducerConfig.METADATA_FETCH_TIMEOUT_CONFIG, Integer.toString(5 * 1000));
   props.setProperty(ProducerConfig.REQUEST_TIMEOUT_CONFIG, Integer.toString(Integer.MAX_VALUE));
   producer = new KafkaProducer(props);
   Data1Length = Integer.parseInt(cl.getPropertiy("hibench.streamingbench.datagen.data1.length"));
 }
예제 #2
0
  public static void main(String[] args) {

    if (args.length < 5) {
      System.err.println(
          "args: <ConfigFile> <DATA_FILE1> <DATA_FILE1_OFFSET> <DATA_FILE2> <DATA_FILE2_OFFSET> need to be specified!");
      System.exit(1);
    }

    ConfigLoader cl = new ConfigLoader(args[0]);

    benchName = cl.getProperty("hibench.streamingbench.benchname").toLowerCase();
    String topic = cl.getProperty("hibench.streamingbench.topic_name");
    String brokerList = cl.getProperty("hibench.streamingbench.brokerList");
    int recordPerInterval =
        Integer.parseInt(
            cl.getProperty("hibench.streamingbench.prepare.periodic.recordPerInterval"));
    int intervalSpan =
        Integer.parseInt(cl.getProperty("hibench.streamingbench.prepare.periodic.intervalSpan"));
    int totalRound =
        Integer.parseInt(cl.getProperty("hibench.streamingbench.prepare.periodic.totalRound"));
    HDFSMaster = cl.getProperty("hibench.hdfs.master");
    dataFile1 = args[1];
    dataFile1Offset = Long.parseLong(args[2]);
    dataFile2 = args[3];
    dataFile2Offset = Long.parseLong(args[4]);
    boolean isNumericData = false;
    if (benchName.contains("statistics")) {
      isNumericData = true;
    }

    NewKafkaConnector con = new NewKafkaConnector(brokerList, cl);

    Timer timer = new Timer();
    timer.schedule(
        new SendTask(totalRound, recordPerInterval, con, topic, isNumericData), 0, intervalSpan);
    System.out.println("Timer scheduled.");
  }