graphql-dotnet apollo federation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so here we go I'm going to show you what I have made so here is my gateway here are my queries as you can see everything is working underneath I have to.net services and here is my gateway so gateways reasoning or the net services so from the net side we have following go we're gonna need to add entity Union we're gonna need to provide service type and we're gonna need to provide this to query fields from how it works so here is service STL which stands for service definition language it's the same schema but these our directives which are used by gateway to perform queries also there is and entities let's say generic reservoir as you can see it also works well here is a service definition for second service yes from.net perspective what do we have so we have this query builder extension which adds just required types we can see it yes here it is second we are creating so-called federated schema which inside just registers required types for Federation to work correctly next we have federated cuvee dia all it does it provides us these two fields yes and this one is totally the same as in schema first approach so it will be extracted next we have entity type Union where we declare our types next our types now extends federated object graph type instead of object graph type which does all of us to use these pieces also it provides us a resolve reference method which is used in these queries so when I call this query underneath this resolver pion code and everything else is the same so to make our craft Federation radio we're going to need to provide these graph types to services we gonna need provide register these types in our schema we gonna need to provide these fields in our query we're gonna need to provide entity type and the cloud our graph types with required details and resolve references let's see this in our second service so again at Federation federated schema entity now with both types our query which hides from us services and entities and here our account types which extends account type by ID here with the findings that ID is an external here our resolver for articles and here is our resolve references the same for article we are defining its key and resolve reference yes the same is works as everything else so from Gateway perspective let's say we are retrieving accounts user name that's all I have added in logger to see which queries are sent to which services so our first service did receive this query without variables and return such response yes when we are adding typed from different services and run this query we can see the following so Gateway did send this query to our first service and our third service due to respond is this response so the K piece here is these type names and ID's which are reference links having such information gateway sense second request our second service this generic generic resolver asking him to resolve these references with these fields and here is response so it is the same queries like here so gateway just knows gateway uses these directives took know which types belong to which services and then use this generic resolver to resolve data combine it all together and send it back to the client so here is another example and as you can see now we are sending query to second service here is the query here is the response and sending back generic query to our first service asking to resolve user names so something like this I hope you guys will accept this change and we will have Federation in our debt Nathan thank you
Info
Channel: Alexandr Marchenko
Views: 835
Rating: 5 out of 5
Keywords: dotnet-graphql, graphql, apollo, apollo federation, apollo gateway, dotnet
Id: Cdzo7HU_r-c
Channel Id: undefined
Length: 7min 45sec (465 seconds)
Published: Wed May 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.