-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Reconsider the name/usage of io.quarkus.grpc.runtime.annotations.GrpcService #16872
Comments
@cescoffier wdyt? If we're going to do it better do it sooner than later and changing the major number in the version is a good occasion |
Of course, this would be a breaking change... |
We could also make |
I would go for client. Stub is reminding me RMI and Corba.
+1 - It would be better too as we can force it to be singleton (it has to be, because it cannot be proxied) I believe we can handle the change without too much breakage. But if we have to, it's the right time. |
No problem. I thought it would make sense because the generated class that is injected has the
Any ideas how? We could mark the annotation as deprecated and pollute the code with special branches for deprecated parts but I don't think it's worth the effort. |
Yes, that's what I was thinking, but if it gets too ugly, we should just break. |
Not only it's ugly but we'll end up with two |
- rename io.quarkus.grpc.runtime.annotations.GrpcService to io.quarkus.grpc.GrpcClient - the relevant literal class is now a static nested class - GrpcClient.value() is optional and the service name can be derived from the annotated element - introduce the io.quarkus.grpc.GrpcService CDI stereotype that can be used to mark a gRPC service class (instead of @singleton) - update docs and tests - resolves quarkusio#16872
This annotation is currently a CDI qualifier and is used to inject a gRPC stub. On the server side a gRPC service should be annotated with
@javax.inject.Singleton
and extend the appropriate service definition (aka the abstractImplBase
class).I think that it would make sense to rename the qualifier to something like
@GrpcClient
(aligned with MP rest client) or@GrpcStub
. And use the@GrpcService
to mark a gRPC service (i.e. impl ofio.grpc.BindableService
). Note that a user does not care about the fact that his gRPC service is a bean, similarly if you create a JAX-RS endpoint you don't need to define the CDI scope either.Moreover, the annotation should not live in
io.quarkus.grpc.runtime.annotations
which is by convention not part of the public API.So my proposal is to:
io.quarkus.grpc.runtime.annotations.GrpcService
toio.quarkus.grpc.GrpcClient
orio.quarkus.grpc.GrpcStub
io.quarkus.grpc.GrpcService
that would be used to mark a gRPC service class (instead of@Singleton
)The text was updated successfully, but these errors were encountered: