armeria icon indicating copy to clipboard operation
armeria copied to clipboard

Automatically inter a blocking type for annotated servcies

Open ikhoon opened this issue 1 year ago • 0 comments

Armeria annotated services use an (service) event loop by default if @Blocking or .useBlockingTaskExecutor(true) is not set.

I think we can improve the static default value to dynamically determine if a blocking executor is necessary.

  • If a return type is not a known asynchronous type, such as CompletableFuture, Mono, Single, and so on, an (service) event loop is used by default.
  • If a return type is a non-IO type such as String, ResponseEntity or something else, a blocking task executor can be used for the methods by default.

This approach will be especially useful for users who are new to Armeria. Related: https://github.com/line/armeria/discussions/5848

ikhoon avatar Jul 31 '24 03:07 ikhoon