Resolve an External Entity with Apollo Federation

Share this video with your friends

Send Tweet

Federated services can also resolve external entities using references. When a service resolves an external entity, it only needs to return a reference to that entity. These references are resolved by the service that defined the entity with a special resolver called __resolveReference.

Joey Ng'ethe
Joey Ng'ethe
~ 5 years ago

This is neat!

Question is, does the individual services have to be federated first for you to use them on the gateway? If yes, do we have equivalent packages for other languages like python to do the same.

For instance, I have multiple services written in python using graphene and I have a gateway written in JS using apollo server and I am currently using schema stitching and remote methods and to build the gateway. I'd like to rewrite the gateway to use federation but I wonder if I can do that given my stack?

Alex Banks
Alex Banks(instructor)
~ 5 years ago

Yes, they gateway interacts with special queries on the service. Right now, it's only JavaScript, but it is possible to implement your own federated service in another language. Apollo has published the specification: https://www.apollographql.com/docs/apollo-server/federation/federation-spec/

Joey Ng'ethe
Joey Ng'ethe
~ 5 years ago

Thanks for this Alex much appreciated.

Is there a guide for doing the same with Mutations and Subscriptions?