-
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
Per-service setting is not possible for annotated service #2023
Comments
Hi @trustin @minwoox @ikhoon , I think what we could do is, add an annotation called If you guys have anything else in mind please feel free to share it so I can implement it. |
How about just adding |
Hello, @sivaalli! Thanks for the suggestion. However, I think adding more annotations is the last thing I want to do. 😄 Had a chat with @trustin and we thought adding a builder would be enough for this. ServerBuilder sb = Server.builder() // Returns ServerBuilder
.annotatedService() // Returns AnnotatedServiceBindingBuilder
// Not sure this is the best name.
.requestTimeoutMillis(5000)
.contentPreview(...)
...
.build(object); // Returns to the ServerBuilder All the properties that a service might want to set separately are gathered in - AbstractBindingBuilder
- AbstractServiceBindingBuilder
- ServiceBindingBuilder
|
Hi @trustin and @minwoox, I think I may have misunderstood this issue. So just want to reiterate the idea. For example, if this is my service:
and annotated service is registered using
Then, we should provide ability for user to
If I'm understanding this correct the point# 2 is what we are trying to achieve right? But your idea sounds good. Sorry If I'm saying things again and again but just wanted to make sure I understand this correctly before I start writing any code. |
Yes, we are going to provide
In this case, we are guiding like: class MyService{
@Get("/foo")
public HttpResponse foo(ServiceRequestContext ctx) { // or RequestContext.current()
ctx.setRequestTimeoutMillis(1000);
return HttpResponse.of(200);
}
}
You are always welcomed to ask us anything. :-) |
Thank you @minwoox. I will start looking into this. |
Motivation: It is good to provide an ability to user to configure per service level settings for annotated service. Modifications: - Pulled all methods that `AbstractServiceBindingBuilder` (minus `AbstractBindingBuilder`) has into an interface called `ServiceConfigSetter`. - `AbstractServiceBindingBuilder` now implements this (`ServiceConfigSetter`) interface and also extends `AbstractBindingBuilder`. - Added a default implementation of `ServiceConfigSetter` called `DefaultServiceConfigSetter`, which is shared between `AbstractServiceBindingBuilder` and `AbstractServiceBuilder` to avoid code duplication. - Added `AnnotatedServiceBindingBuilder` and `VirtualHostAnnotatedServiceBindingBuilder`. Result: - Closes #2023 - Annotated services can now be configured to have service-specific properties.
Motivation: It is good to provide an ability to user to configure per service level settings for annotated service. Modifications: - Pulled all methods that `AbstractServiceBindingBuilder` (minus `AbstractBindingBuilder`) has into an interface called `ServiceConfigSetter`. - `AbstractServiceBindingBuilder` now implements this (`ServiceConfigSetter`) interface and also extends `AbstractBindingBuilder`. - Added a default implementation of `ServiceConfigSetter` called `DefaultServiceConfigSetter`, which is shared between `AbstractServiceBindingBuilder` and `AbstractServiceBuilder` to avoid code duplication. - Added `AnnotatedServiceBindingBuilder` and `VirtualHostAnnotatedServiceBindingBuilder`. Result: - Closes line#2023 - Annotated services can now be configured to have service-specific properties.
Motivation: It is good to provide an ability to user to configure per service level settings for annotated service. Modifications: - Pulled all methods that `AbstractServiceBindingBuilder` (minus `AbstractBindingBuilder`) has into an interface called `ServiceConfigSetter`. - `AbstractServiceBindingBuilder` now implements this (`ServiceConfigSetter`) interface and also extends `AbstractBindingBuilder`. - Added a default implementation of `ServiceConfigSetter` called `DefaultServiceConfigSetter`, which is shared between `AbstractServiceBindingBuilder` and `AbstractServiceBuilder` to avoid code duplication. - Added `AnnotatedServiceBindingBuilder` and `VirtualHostAnnotatedServiceBindingBuilder`. Result: - Closes line#2023 - Annotated services can now be configured to have service-specific properties.
A user can configure per-service settings using fluent
Route
API.However, this is only for the services which implement
HttpService
, not for the annotated service.We should provide a way for annotated service as well.
The text was updated successfully, but these errors were encountered: