【发布时间】:2020-12-10 12:37:23
【问题描述】:
我正在尝试将我的 Quarkus vertx 示例代码转换为 Vertx 4.0,并发现了一些问题。
例如,the original method in Quarkus 使用 Java 8 CompletionStage。
this.posts.findAll()
.thenAccept(
data -> rc.response()
.end(toJson(data))
);
并转换为Vertx Future codes。
this.posts.findAll()
.onSuccess(
data -> rc.response().end(Json.encode(data))
);
Java 8 CompletionStages thenApply、thenCompose 可以在 Vertx 代码中转换为 map、flatmap/compose。
没有与thenAccept 等效的方法。
【问题讨论】: