opengemini-client-java icon indicating copy to clipboard operation
opengemini-client-java copied to clipboard

需要支持匹配插入的配置

Open ljz0721cx opened this issue 1 year ago • 0 comments

目前执行时候需要手动组装list,需要用户来组装,期望可以让用户无感知.

public CompletableFuture<Void> writeBatch(String database, List<Point> points) {
        String writeUrl = getWriteUrl(database);
        StringJoiner sj = new StringJoiner("\n");
        points.forEach(point -> sj.add(point.toString()));
        RequestBody requestBody = RequestBody.create(JSON, sj.toString());
        return httpExcute(writeUrl, Void.class, UrlConst.POST, requestBody);
    }

批量执行在sdk中封装,将sdk执行批量的线程可以配置到外部配置中

  // 开启批处理配置,像这样配置执行后,可以让用户无感知执行批量,并且可以增加系统的吞吐量
      influxDB.enableBatch(
              BatchOptions.DEFAULTS
                      .threadFactory(runnable -> {
                          Thread thread = new Thread(runnable);
                          thread.setDaemon(true);
                          return thread;
                      })
      );
  

ljz0721cx avatar May 08 '24 10:05 ljz0721cx