Gopal S Akshintala
02/11/2020, 5:02 PMIO with Spring-boot for asynchronous servlets, just like returning a CompletableFuture from a REST Controller in Spring-boot?pakoito
02/11/2020, 5:03 PMpakoito
02/11/2020, 5:03 PMBob Glamm
02/11/2020, 5:05 PMMono<A> or Flux<A> (single A or stream of A responses, respectively)Gopal S Akshintala
02/11/2020, 5:05 PMBob Glamm
02/11/2020, 5:05 PMHow can I usewith Spring-boot for asynchronous servletsIO
Bob Glamm
02/11/2020, 5:06 PMGopal S Akshintala
02/11/2020, 5:06 PM@PostMapping("/add-book")
public CompletableFuture<CatalogueBookResponse> addBookToCatalogue(@Valid @RequestBody AddBookToCatalogueRequest addBookToCatalogueRequest) {Bob Glamm
02/11/2020, 5:06 PMGopal S Akshintala
02/11/2020, 5:06 PMGopal S Akshintala
02/11/2020, 5:07 PMCompletableFuture
.supplyAsync(() -> IO.unsafeRunSync)Gopal S Akshintala
02/11/2020, 5:07 PMGopal S Akshintala
02/11/2020, 5:07 PMGopal S Akshintala
02/11/2020, 5:09 PMBob Glamm
02/11/2020, 5:10 PMBob Glamm
02/11/2020, 5:10 PMIO<A> -> CompletableFuture<A>Bob Glamm
02/11/2020, 5:10 PMIOGopal S Akshintala
02/11/2020, 5:11 PMBob Glamm
02/11/2020, 5:11 PMGopal S Akshintala
02/11/2020, 5:11 PMBob Glamm
02/11/2020, 5:12 PMHttpMessageConverter, maybe, but I'm not sure if more than one of those get called per controllerBob Glamm
02/11/2020, 5:12 PMIO<A> -> CompletableFuture<A> -> some external representation of A, like JSONBob Glamm
02/11/2020, 5:12 PMBob Glamm
02/11/2020, 5:13 PMGopal S Akshintala
02/11/2020, 5:14 PMstojan
02/11/2020, 6:33 PMsuspended method to convert to CoroutinesBob Glamm
02/11/2020, 9:50 PMIO that converts it to CompletableFuture would likely be preferable over a filter or interceptor or converter that converts IO -> CompletableFutureHiosdra
02/12/2020, 9:01 AMclass ScalaFutureHandler(timeoutMillis: Long)(implicit ec: ExecutionContext)
extends AsyncHandlerMethodReturnValueHandler {
And overriten 3 methods:
isAsyncReturnValue
supportsReturnType
handleReturnValue
This allowed us to return Future[A]Hiosdra
02/12/2020, 9:14 AM