-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ServiceOptions
to Service
#5071
Comments
Hi, @ikhoon. I've made a PR on this issue 😀 |
trustin
pushed a commit
that referenced
this issue
Jun 10, 2024
Motivation: Allow users to set default options for a specific service Modifications: - Add `ServiceOptions` and `@ServiceOption` annotation to allow users specify default options Result: Users are able to set service specific options like below ```java final HttpService httpService = new HttpService() { ... @OverRide public ServiceOptions options() { return defaultServiceOptions; } }; ``` or use annotation ```java final class MyService { @ServiceOption(requestTimeoutMillis = 11111, maxRequestLength = 1111, requestAutoAbortDelayMillis = 111) @get("/test1") public HttpResponse test() { return HttpResponse.of("OK"); } ... } ``` - Closes <#5071>. (If this resolves the issue.) <!-- Visit this URL to learn more about how to write a pull request description: https://armeria.dev/community/developer-guide#how-to-write-pull-request-description --> --------- Co-authored-by: minux <songmw725@gmail.com> Co-authored-by: jrhee17 <guins_j@guins.org> Co-authored-by: Ikhun Um <ih.pert@gmail.com> Co-authored-by: Ikhun Um <ikhun.um@linecorp.com> Co-authored-by: minux <minu.song@linecorp.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, there is no way to set the default options for a specific service.
Users should override the default options for a service when it is bound to a server.
armeria/core/src/main/java/com/linecorp/armeria/server/ServiceBindingBuilder.java
Line 64 in b78d951
If we provide a way to provide the default options from a service, users can define a sensible default option for certain services when implementing the service.
We can also define an annotation like
@ServiceOption
to inject the values toServiceOptions
for annotated services.The text was updated successfully, but these errors were encountered: