我的 Spring boot 应用程序中有一个如下所示的方法。
public Flux<Data> search(SearchRequest request) {
Flux<Data> result = searchService.search(request);//this returns Flux<Data>
Mono<List<Data>> listOfData = result.collectList();
// doThisAsync() // here I want to pass this list and run some processing on it
// the processing should happen async and the search method should return immediately.
return result;
}
//this method uses the complete List<Data> returned by above method
public void doThisAsync(List<Data> data) {
//do some processing here
}
Run Code Online (Sandbox Code Playgroud)
目前,我正在使用带@Async注释的服务类doThisAsync,但不知道如何传递List<Data>,因为我不想调用block. …
spring reactive-programming spring-boot project-reactor spring-webflux