Skip to content
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

feat: consolidating AddHandler for RPC interface #21

Merged
merged 1 commit into from
Jul 19, 2024
Merged

Conversation

jgkawell
Copy link
Member

@jgkawell jgkawell commented Jul 19, 2024

This PR consolidates the functionality of the AddHandler and reflection methods in the RPC interface within the chassis. The previous setup required a few different calls for the same amount of work and didn't support gRPC servers (as opposed to ConnectRPC) very well. The new pattern simplifies things so that you can do the following:

// for ConnectRPC
pattern, handler := kvConnect.NewKeyValueServiceHandler(h)
server.AddHandler(pattern, handler, true)

// for gRPC
grpcServer := server.GetGrpcServer()
discoverygrpc.RegisterAggregatedDiscoveryServiceServer(grpcServer, c.xDSServer)
server.AddHandler("/envoy.service.discovery.v3.AggregatedDiscoveryService/", grpcServer, false)

I also removed the logger access as this shouldn't be managed at this layer. It should be managed at the handler layer instead and injected down from main() at instantiation.

@jgkawell jgkawell merged commit 76b0970 into main Jul 19, 2024
2 checks passed
@jgkawell jgkawell deleted the feat/rpc-changes branch July 19, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant