Skip to content

Instantly share code, notes, and snippets.

@toby55kij
Created August 21, 2023 09:09
Show Gist options
  • Save toby55kij/a02712d2781bf0da00c9e1a4a5841ed8 to your computer and use it in GitHub Desktop.
Save toby55kij/a02712d2781bf0da00c9e1a4a5841ed8 to your computer and use it in GitHub Desktop.
ブロッキング処理を呼び出す例2
@GetMapping("/foo/{id}")
public Mono<ReturnValue> get(ServerWebeExchange exchange, @PathVariable Long id) {
return Mono.fromCallable(() -> {
return getValue(id);
}).subscribeOn(Schedulers.boundedElastic());
}
ReturnValue getValue(long id) {
// ブロッキング処理
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment