-
Notifications
You must be signed in to change notification settings - Fork 0
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
POC: Use gRPC instead of HTTP to communicate to services #1
base: master
Are you sure you want to change the base?
Conversation
if (config.type === 'grpc') { | ||
return new GrpcGraphQLDataSource(config); | ||
} | ||
return new RemoteGraphQLDataSource(config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we trying to handle both grpc and http case now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it in there during my experimentation. I don't see any harm in allowing both in case some service really wants to expose an HTTP /graphql endpoint, but we will encourage the use gRPC
require 'json' | ||
require_relative './gen/federation_api_pb' | ||
require_relative './gen/federation_api_services_pb' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this file graphql_grpc_server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a proof of concept 😉
This approach LGTM, can you run it with the frontend infra team? |
Description
Implement and use our own
GrpcGraphQLDataSource
instead of relying on apollo-gateway's default HTTP data source.Manual Testing
To test it out, follow the instructions here: https://github.com/Gusto/apollo-federation-ruby#example
Open up the graphql playground after starting the gateway by visiting
http://localhost:50000/graphql
Future
Apollo has plans in the future to make their server less reliant on HTTP, which will make this even easier (since right now we have to pull out and ignore the
http
field of the request).