助焊剂到列表 无阻塞

问题描述 投票:1回答:1

正在寻找将助焊剂转换为列表。如果我使用block()会出错。因此,需要进行转换而不会阻塞呼叫。

Flux.from(Collection.find())

使用反应式编程,但graphql期望List并返回Flux时出错。

带有Block()的代码

public List<Test> findAll() {
        return Flux.from(testCollection.find()).collectList().block();

}

错误:-

block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-kqueue-7

在这里,我无法返回Flux来获取一些护卫,因此我需要返回List。

谢谢

java reactive-programming project-reactor graphql-java
1个回答
0
投票

如评论中所述,您不能。反应模式将保持流动。

所以,

Mono<GraphqlResponse> = Flux.just("A", "B" "C")
  .collectList()
  .map(this::someMethod);

GraphqlResponse someMethod(List<String> abcs) {
    return graphQl.doSomething(abcs);
}
© www.soinside.com 2019 - 2024. All rights reserved.