-
Notifications
You must be signed in to change notification settings - Fork 826
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
Support *not* autoconfiguring client and server when address starts with "none" #419
Comments
Let's check whether I got you right.
As for the client, why do you wish it not to be created instead of pointing to a arbitary unavailable address? As long as it is not used it is quite cheap AFAICT. And IMO dealing with NPEs is far more troublesome than an UNAVAILABLE error. Or do you wish to have a NameResolver that resolves the |
I don't want to point to an arbitrary address, not sure why you think that, As for the server, even more reason to not have a gRPC server running with services that I don't need. It's the same idea as testing a "slice" of the application using Spring Boot.
|
You probably got me wrong here, but nevermind. As for the server, I'm not sure if I prefer the address none or the autoconfigure exclude variant. |
Note that disabling the autoconfig is a global switch, whereas address none allows for more fine-grained control, where user may want to turn off one but keep another. |
It is possible to exclude a single autoconfig: spring.autoconfigure.exclude=net.devh.boot.grpc.server.autoconfigure.GrpcServerFactoryAutoConfiguration Also it might already be possible by using: grpc.server.port=-1
# and not configuring
#grpc.server.in-process-name= |
This I knew; what I meant is it's not possible this way to disable one service, but keep another. This turns off all gRPC service autoconfig.
This, I think, is what I'm looking for; however, there's no support for this on the client side, and so it won't be consistent if we use different ways for server and client. Also, setting the port as -1 to disable service is not exactly intuitive. |
Well it's the first thing that came to my mind when I implemented it. |
I just think it’s good to be consistent, and in my case, both are needed. |
Sorry, I didn't clearly answer this question before. I agree deprecating it is a good idea; you can deprecate in |
Looking at how other frameworks are supporting gRPC, seems Micronaut can disable the server using https://micronaut-projects.github.io/micronaut-grpc/snapshot/guide/index.html If you implement this, the client can be disable similarly, using |
The problem
Currently, annotations
@GrpcService
and@GrpcClient
autoconfigure the server and the client respectively. For integration testing, we can use in process server and client as explained here. In my case, I've aclient-A
that callsservice-A
that callsclient-B
that callsexternal-service-B
. Depending on the test scenario, I substitute in process versions forservice-A
andexternal-service-B
to test the flow, or use the real ones.What I'd like to do now is use the same test for calling
service-A
deployed in my integration environment. That means, I only need in processclient-A
, andservice-A
andclient-B
beans shouldn't be created.The solution
Just like in process is given special treatment now, it'd be nice to have the library support this use case by not configuring client/server that begins with
none
in their address. I'd pointclient-A
to the remoteservice-A
deployed in my integration environment and run the same test I run when I use localservice-A
.Alternatives considered
One way is to use a Spring profile with
@GrpcService
in a@Configuration
class, such the the beans are created only if Spring profileintegration
isn't active. That's fine, but it makes the Production code coupled with test code.Another option is to simply let
service-A
andclient-B
beans be created, but not use them. This is very confusing and could lead to bugs since we have no way to tell whetherclient-A
is talking to localservice-A
, or remote one.The text was updated successfully, but these errors were encountered: