我有以下简单的消费者应用程序。我想知道如何使消费者仅在当前异步过程完成后才拉取下一条消息
@SpringBootApplication
public class Application {
@Bean
public Consumer<String> test() {
return url -> {
return WebClient
.builder()
.baseUrl(url)
.retrieve()
.bodyToMono(String.class)
.map(data -> {
// process data
// pull the next message
})
}
}
}
后续问题: 如何在处理器应用程序中处理这个问题
@SpringBootApplication
public class Application {
@Bean
public Function<String, String> test() {
return url -> {
return WebClient
.builder()
.baseUrl(url)
.retrieve()
.bodyToMono(String.class)
.map(data -> {
// output the data and pull the next message
})
}
}
}