-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
目前执行时候需要手动组装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;
})
);
Metadata
Metadata
Assignees
Labels
No labels