armeria
armeria copied to clipboard
Automatically inter a blocking type for annotated servcies
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,ResponseEntityor 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