{"id":299303,"date":"2020-02-26T15:00:31","date_gmt":"2020-02-26T15:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=299303"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=299303","title":{"rendered":"\u041a\u0430\u043a GraphQL-\u0438\u0442\u044c \u043d\u0430 Kotlin \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/490002\/\">\n<p><a href=\"https:\/\/graphql.org\/\" rel=\"nofollow\">GraphQL<\/a> \u2014 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 Facebook. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 GraphQL API \u043d\u0430 JVM, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044f\u0437\u044b\u043a\u0430 Kotlin \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/micronaut.io\/\" rel=\"nofollow\">Micronaut<\/a>; \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 Java\/Kotlin \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445. \u0417\u0430\u0442\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e GraphQL \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u043e \u0432\u0441\u0435\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/\" rel=\"nofollow\">Apollo Server<\/a> \u0438 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/federation\/introduction\/\" rel=\"nofollow\">Apollo Federation<\/a>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ib\/hf\/zb\/ibhfzb4v5pkcm3bmnencdcamyym.png\" alt=\"architecture\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043e\u0441\u0432\u0435\u0449\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 GraphQL API. \u0414\u043e\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043b\u0430\u043d\u0435\u0442\u0430\u0445 \u0421\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u0438\u0445 \u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0430\u0445.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/jdk.java.net\" rel=\"nofollow\">JDK<\/a> 11+<\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/get-npm\" rel=\"nofollow\">npm<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h1>Planet service<\/h1>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 GraphQL, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u0430\u043b\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">implementation(&quot;io.micronaut.graphql:micronaut-graphql:$micronautGraphQLVersion&quot;) implementation(&quot;io.gqljf:graphql-java-federation:$graphqlJavaFederationVersion&quot;)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/build.gradle.kts\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/micronaut-projects\/micronaut-graphql\" rel=\"nofollow\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 <a href=\"https:\/\/www.graphql-java.com\/\" rel=\"nofollow\">GraphQL Java<\/a> \u0438 Micronaut, \u0442\u043e \u0435\u0441\u0442\u044c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u043d\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, GraphQL \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 Spring and Micronaut; \u043e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 GET \u0438 POST \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0443 <code>\/graphql<\/code>. \u0412\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 GraphQL Java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 Apollo Federation.<\/p>\n<p>  <\/p>\n<p>GraphQL \u0441\u0445\u0435\u043c\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/schema\/schema\/\" rel=\"nofollow\">Schema Definition Language<\/a> (SDL) \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">type Query {     planets: [Planet!]!     planet(id: ID!): Planet     planetByName(name: String!): Planet }  type Mutation {     createPlanet(name: String!, type: Type!, details: DetailsInput!): Planet! }  type Subscription {     latestPlanet: Planet! }  type Planet @key(fields: &quot;id&quot;) {     id: ID!     name: String!     # from an astronomical point of view     type: Type!     isRotatingAroundSun: Boolean! @deprecated(reason: &quot;Now it is not in doubt. Do not use this field&quot;)     details: Details! }  interface Details {     meanRadius: Float!     mass: BigDecimal! }  type InhabitedPlanetDetails implements Details {     meanRadius: Float!     mass: BigDecimal!     # in billions     population: Float! }  type UninhabitedPlanetDetails implements Details {     meanRadius: Float!     mass: BigDecimal! }  enum Type {     TERRESTRIAL_PLANET     GAS_GIANT     ICE_GIANT     DWARF_PLANET }  input DetailsInput {     meanRadius: Float!     mass: MassInput!     population: Float }  input MassInput {     number: Float!     tenPower: Int! }  scalar BigDecimal<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0421\u0445\u0435\u043c\u0430 Planet service (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0435 <code>Planet.id<\/code> \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f <code>ID<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 5-\u0438 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0445 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/schema\/schema\/#scalar-types\" rel=\"nofollow\">\u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432<\/a>. GraphQL Java <a href=\"https:\/\/www.graphql-java.com\/documentation\/master\/scalars\/\" rel=\"nofollow\">\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442<\/a> \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0430\u043b\u044f\u0440\u043e\u0432 \u0438 \u043e\u0431\u0435\u0441\u043f\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445. \u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u043e\u0441\u043a\u043b\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null, \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 (\u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e \u043c\u0435\u0436\u0434\u0443 Kotlin \u0438 GraphQL \u0432 \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f nullable \u0442\u0438\u043f\u043e\u0432). <code>@directive<\/code>\u2019\u044b \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0434\u0430\u043b\u0435\u0435. \u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0445\u0435\u043c\u0430\u0445 \u0438 \u0438\u0445 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/graphql.org\/learn\/schema\/\" rel=\"nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0433\u0430\u0439\u0434\u0435<\/a>. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 IntelliJ IDEA, \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c JS GraphQL plugin \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0445\u0435\u043c\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u0442 \u0434\u0432\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 GraphQL API:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p>schema-first<\/p>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 (\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, API), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u043a\u043e\u0434\u0435<\/p>\n<p>  <\/li>\n<li>\n<p>code-first<\/p>\n<p>  <\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0434\u0430<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041e\u0431\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0438\u043c\u0435\u044e\u0442 \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438; \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/www.prisma.io\/blog\/the-problems-of-schema-first-graphql-development-x1mn4cb0tyl3\" rel=\"nofollow\">\u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b schema-first \u0441\u043f\u043e\u0441\u043e\u0431. <a href=\"https:\/\/github.com\/graphql-java\/awesome-graphql-java#schema-libraries\" rel=\"nofollow\">\u0417\u0434\u0435\u0441\u044c<\/a> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 Micronaut \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043e\u043f\u0446\u0438\u044f, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c GraphQL IDE \u2014 GraphiQL \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">graphql:   graphiql:     enabled: true<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 GraphiQL (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/resources\/application.yml\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>Main \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">object PlanetServiceApplication {      @JvmStatic     fun main(args: Array&lt;String&gt;) {         Micronaut.build()             .packages(&quot;io.graphqlfederation.planetservice&quot;)             .mainClass(PlanetServiceApplication.javaClass)             .start()     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>Main \u043a\u043b\u0430\u0441\u0441 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/PlanetServiceApplication.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>GraphQL \u0431\u0438\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Bean @Singleton fun graphQL(resourceResolver: ResourceResolver): GraphQL {     val schemaInputStream = resourceResolver.getResourceAsStream(&quot;classpath:schema.graphqls&quot;).get()     val transformedGraphQLSchema = FederatedSchemaBuilder()         .schemaInputStream(schemaInputStream)         .runtimeWiring(createRuntimeWiring())         .excludeSubscriptionsFromApolloSdl(true)         .build()      return GraphQL.newGraphQL(transformedGraphQLSchema)         .instrumentation(             ChainedInstrumentation(                 listOf(                     FederatedTracingInstrumentation()                     \/\/ uncomment if you need to enable the instrumentations. but this may affect showing documentation in a GraphQL client                     \/\/ MaxQueryComplexityInstrumentation(50),                     \/\/ MaxQueryDepthInstrumentation(5)                 )             )         )         .build() }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041a\u043e\u043d\u0444\u0438\u0433 GraphQL (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>FederatedSchemaBuilder<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/federation\/federation-spec\/\" rel=\"nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/a> Apollo Federation. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c GraphQL Java \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u0433\u0440\u0430\u0444, \u043a\u043e\u043d\u0444\u0438\u0433 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f (\u0441\u043c. <a href=\"https:\/\/www.graphql-java.com\/tutorials\/getting-started-with-spring-boot\/\" rel=\"nofollow\">\u0433\u0430\u0439\u0434<\/a>).<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 <code>RuntimeWiring<\/code> \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f data fetcher\u2019\u043e\u0432, type resolver\u2019\u043e\u0432 \u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0441\u043a\u0430\u043b\u044f\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>GraphQLSchema<\/code>; \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">private fun createRuntimeWiring(): RuntimeWiring {     val detailsTypeResolver = TypeResolver { env -&gt;         when (val details = env.getObject() as DetailsDto) {             is InhabitedPlanetDetailsDto -&gt; env.schema.getObjectType(&quot;InhabitedPlanetDetails&quot;)             is UninhabitedPlanetDetailsDto -&gt; env.schema.getObjectType(&quot;UninhabitedPlanetDetails&quot;)             else -&gt; throw RuntimeException(&quot;Unexpected details type: ${details.javaClass.name}&quot;)         }     }      return RuntimeWiring.newRuntimeWiring()         .type(&quot;Query&quot;) { builder -&gt;             builder                 .dataFetcher(&quot;planets&quot;, planetsDataFetcher)                 .dataFetcher(&quot;planet&quot;, planetDataFetcher)                 .dataFetcher(&quot;planetByName&quot;, planetByNameDataFetcher)         }         .type(&quot;Mutation&quot;) { builder -&gt;             builder.dataFetcher(&quot;createPlanet&quot;, createPlanetDataFetcher)         }         .type(&quot;Subscription&quot;) { builder -&gt;             builder.dataFetcher(&quot;latestPlanet&quot;, latestPlanetDataFetcher)         }         .type(&quot;Planet&quot;) { builder -&gt;             builder.dataFetcher(&quot;details&quot;, detailsDataFetcher)         }         .type(&quot;Details&quot;) { builder -&gt;             builder.typeResolver(detailsTypeResolver)         }         .type(&quot;Type&quot;) { builder -&gt;             builder.enumValues(NaturalEnumValuesProvider(Planet.Type::class.java))         }         .build() }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>RuntimeWiring<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f root-\u0442\u0438\u043f\u0430 <code>Query<\/code> (\u0434\u0440\u0443\u0433\u0438\u0435 root-\u0442\u0438\u043f\u044b \u044d\u0442\u043e <code>Mutation<\/code> \u0438 <code>Subscription<\/code>), \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u043f\u043e\u043b\u0435 <code>planets<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u0434\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 <code>DataFetcher<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class PlanetsDataFetcher(     private val planetService: PlanetService,     private val planetConverter: PlanetConverter ) : DataFetcher&lt;List&lt;PlanetDto&gt;&gt; {     override fun get(env: DataFetchingEnvironment): List&lt;PlanetDto&gt; = planetService.getAll()         .map { planetConverter.toDto(it) } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>PlanetsDataFetcher<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/DataFetchers.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>env<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u043a\u043e\u0434\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0443\u0440\u043e\u0432\u043d\u044f \u0411\u0414 \u0432 DTO, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0430\u044f\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class PlanetConverter : GenericConverter&lt;Planet, PlanetDto&gt; {     override fun toDto(entity: Planet): PlanetDto {         val details = DetailsDto(id = entity.detailsId)          return PlanetDto(             id = entity.id,             name = entity.name,             type = entity.type,             details = details         )     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>PlanetConverter<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/misc\/Converters.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p><code>GenericConverter<\/code> \u2014 \u044d\u0442\u043e \u043e\u0431\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>Entity \u2192 DTO<\/code>. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e <code>details<\/code> \u2014 \u044d\u0442\u043e <em>\u0442\u044f\u0436\u0451\u043b\u043e\u0435<\/em> \u043f\u043e\u043b\u0435, \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c API. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <em>\u043f\u0440\u043e\u0441\u0442\u044b\u0435<\/em> \u043f\u043e\u043b\u044f, \u0430 \u0434\u043b\u044f <code>details<\/code> \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435 <code>id<\/code>. \u0420\u0430\u043d\u0435\u0435, \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>RuntimeWiring<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u044f <code>details<\/code> \u0442\u0438\u043f\u0430 <code>Planet<\/code> \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d <code>DataFetcher<\/code>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0439 \u0442\u0430\u043a (\u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f <code>details.id<\/code>, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u043d\u0435\u0435):<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class DetailsDataFetcher : DataFetcher&lt;CompletableFuture&lt;DetailsDto&gt;&gt; {      private val log = LoggerFactory.getLogger(this.javaClass)      override fun get(env: DataFetchingEnvironment): CompletableFuture&lt;DetailsDto&gt; {         val planetDto = env.getSource&lt;PlanetDto&gt;()         log.info(&quot;Resolve `details` field for planet: ${planetDto.name}&quot;)          val dataLoader: DataLoader&lt;Long, DetailsDto&gt; = env.getDataLoader(&quot;details&quot;)          return dataLoader.load(planetDto.details.id)     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>DetailsDataFetcher<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/DataFetchers.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <code>CompletableFuture<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <code>Details<\/code> \u0438\u0437 <code>DetailsService<\/code>, \u043d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b <em>\u043d\u0430\u0438\u0432\u043d\u043e\u0439<\/em> \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 N+1: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{   planets {     name     details {       meanRadius     }   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0451\u043c\u043a\u043e\u0433\u043e GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/em><\/p>\n<p>  <\/p>\n<p>\u0434\u043b\u044f \u043f\u043e\u043b\u044f <code>details<\/code> \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043f\u043b\u0430\u043d\u0435\u0442 \u0431\u044b\u043b \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 SQL \u0437\u0430\u043f\u0440\u043e\u0441. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/graphql-java\/java-dataloader\" rel=\"nofollow\">java-dataloader<\/a>; \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u0438\u043d\u044b <code>BatchLoader<\/code> \u0438 <code>DataLoaderRegistry<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">\/\/ bean's scope is `Singleton`, because `BatchLoader` is stateless @Bean @Singleton fun detailsBatchLoader(): BatchLoader&lt;Long, DetailsDto&gt; = BatchLoader { keys -&gt;     CompletableFuture.supplyAsync {         detailsService.getByIds(keys)             .map { detailsConverter.toDto(it) }     } }  \/\/ bean's (default) scope is `Prototype`, because `DataLoader` is stateful @Bean fun dataLoaderRegistry() = DataLoaderRegistry().apply {     val detailsDataLoader = DataLoader.newDataLoader(detailsBatchLoader())     register(&quot;details&quot;, detailsDataLoader) }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>BatchLoader<\/code> \u0438 <code>DataLoaderRegistry<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p><code>BatchLoader<\/code> \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <code>Details<\/code> \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 SQL \u0432\u044b\u0437\u043e\u0432\u0430 \u0432\u043c\u0435\u0441\u0442\u043e N+1. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 GraphQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0448\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u043b\u043e\u0433 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b. <code>BatchLoader<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f stateless \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u043e\u043c. <code>DataLoader<\/code> \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 <code>BatchLoader<\/code>; \u043e\u043d stateful, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 <code>DataLoaderRegistry<\/code>. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0431\u0438\u0437\u0435\u0441-\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0448\u0430\u0440\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u0431\u0430\u0442\u0447\u0438\u043d\u0433\u0443 \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0432\u044b \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0432 <a href=\"https:\/\/www.graphql-java.com\/documentation\/master\/batching\/\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 GraphQL Java<\/a>.<\/p>\n<p>  <\/p>\n<p><code>Details<\/code> \u0432 GraphQL \u0441\u0445\u0435\u043c\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>RuntimeWiring<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <code>TypeResolver<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u043c\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 GraphQL \u0442\u0438\u043f\u0443 \u043a\u0430\u043a\u043e\u0439 DTO \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">val detailsTypeResolver = TypeResolver { env -&gt;     when (val details = env.getObject() as DetailsDto) {         is InhabitedPlanetDetailsDto -&gt; env.schema.getObjectType(&quot;InhabitedPlanetDetails&quot;)         is UninhabitedPlanetDetailsDto -&gt; env.schema.getObjectType(&quot;UninhabitedPlanetDetails&quot;)         else -&gt; throw RuntimeException(&quot;Unexpected details type: ${details.javaClass.name}&quot;)     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>TypeResolver<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 enum\u2019\u043e\u0432 \u0432 \u043c\u0443\u0442\u0430\u0446\u0438\u044f\u0445 \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c\u0441\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">.type(&quot;Type&quot;) { builder -&gt;     builder.enumValues(NaturalEnumValuesProvider(Planet.Type::class.java)) }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 enum (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e <code>http:\/\/localhost:8082\/graphiql<\/code> \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c GraphiQL IDE, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0432 \u0441\u0445\u0435\u043c\u0435; IDE \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 3 \u0447\u0430\u0441\u0442\u0438: \u0437\u0430\u043f\u0440\u043e\u0441 (query\/mutation\/subscription), \u043e\u0442\u0432\u0435\u0442 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tk\/pu\/ss\/tkpusskgk5ot_syf21vzxzzx1vo.png\" alt=\"graphiql\"><\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 GraphQL IDE, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/prisma-labs\/graphql-playground\" rel=\"nofollow\">GraphQL Playground<\/a> \u0438 <a href=\"https:\/\/altair.sirmuel.design\/\" rel=\"nofollow\">Altair<\/a> (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u043a\u0430\u043a desktop \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0438 web-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430). \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bo\/7r\/-z\/bo7r-zfg5z2_aln9hkso-quly7u.png\" alt=\"altair\"><\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u043c\u0438\u043c\u043e query, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0445\u0435\u043c\u0435, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445: <code>_service<\/code> \u0438 <code>_entities<\/code>. \u041e\u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u0435\u0442 GraphQL Java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Apollo Federation; \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0432\u0435\u0449\u0451\u043d \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442\u0435 \u0432 \u0442\u0438\u043f <code>Planet<\/code>, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0435\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/my\/l4\/wf\/myl4wfcpz6mo4bf-zt9j1gm3xsy.png\" alt=\"altair docs\"><\/p>\n<p>  <\/p>\n<p>\u0418 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u044f <code>type<\/code>, \u0438 <a href=\"https:\/\/www.apollographql.com\/docs\/graphql-tools\/schema-directives\/\" rel=\"nofollow\">\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430<\/a> <code>@deprecated<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u044f <code>isRotatingAroundSun<\/code> \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0441\u0445\u0435\u043c\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0445\u0435\u043c\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043e\u0434\u043d\u0430 <a href=\"https:\/\/graphql.org\/learn\/queries\/#mutations\" rel=\"nofollow\">\u043c\u0443\u0442\u0430\u0446\u0438\u044f<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">type Mutation {     createPlanet(name: String!, type: Type!, details: DetailsInput!): Planet! }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041c\u0443\u0442\u0430\u0446\u0438\u044f (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0438 query, \u043c\u0443\u0442\u0430\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u0442\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>input<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>type<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">input DetailsInput {     meanRadius: Float!     mass: MassInput!     population: Float }  input MassInput {     number: Float!     tenPower: Int! }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Input<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0438 \u0434\u043b\u044f Query, \u0434\u043b\u044f \u043c\u0443\u0442\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d <code>DataFetcher<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class CreatePlanetDataFetcher(     private val objectMapper: ObjectMapper,     private val planetService: PlanetService,     private val planetConverter: PlanetConverter ) : DataFetcher&lt;PlanetDto&gt; {      private val log = LoggerFactory.getLogger(this.javaClass)      override fun get(env: DataFetchingEnvironment): PlanetDto {         log.info(&quot;Trying to create planet&quot;)          val name = env.getArgument&lt;String&gt;(&quot;name&quot;)         val type = env.getArgument&lt;Planet.Type&gt;(&quot;type&quot;)         val detailsInputDto = objectMapper.convertValue(env.getArgument(&quot;details&quot;), DetailsInputDto::class.java)          val newPlanet = planetService.create(             name,             type,             detailsInputDto.meanRadius,             detailsInputDto.mass.number,             detailsInputDto.mass.tenPower,             detailsInputDto.population         )          return planetConverter.toDto(newPlanet)     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>DataFetcher<\/code> \u0434\u043b\u044f \u043c\u0443\u0442\u0430\u0446\u0438\u0438 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/DataFetchers.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0451\u043d\u043d\u044b\u043c \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d subscription:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">type Subscription {     latestPlanet: Planet! }<\/code><\/pre>\n<p>  <\/p>\n<p><em>Subscription (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p><code>DataFetcher<\/code> \u0434\u043b\u044f subscription \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>Publisher<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class LatestPlanetDataFetcher(     private val planetService: PlanetService,     private val planetConverter: PlanetConverter ) : DataFetcher&lt;Publisher&lt;PlanetDto&gt;&gt; {      override fun get(environment: DataFetchingEnvironment) = planetService.getLatestPlanet().map { planetConverter.toDto(it) } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>DataFetcher<\/code> \u0434\u043b\u044f subscription (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/web\/graphql\/DataFetchers.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 mutation \u0438 subscription \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0434\u0432\u0430 \u0442\u0430\u0431\u0430 \u043b\u044e\u0431\u043e\u0439 GraphQL IDE \u0438\u043b\u0438 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 IDE; \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0448\u0438\u0442\u0435\u0441\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 IDE \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c subscription URL <code>ws:\/\/localhost:8082\/graphql-ws<\/code>):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">subscription {   latestPlanet {     name     type   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440 subscription<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043c\u0443\u0442\u0430\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mutation {   createPlanet(     name: &quot;Pluto&quot;     type: DWARF_PLANET     details: { meanRadius: 50.0, mass: { number: 0.0146, tenPower: 24 } }   ) {     id   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440 mutation<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0451\u043d \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ob\/ym\/zv\/obymzvd2a_dfnh-muwuq-nfddok.gif\" alt=\"mutation subscription\"><\/p>\n<p>  <\/p>\n<p>Subscription\u2019\u044b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 Micronaut \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">graphql:   graphql-ws:     enabled: true<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 GraphQL \u043f\u043e web sockets (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/resources\/application.yml\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 subscription\u2019\u043e\u0432 \u0432 Micronaut \u2014 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/micronaut-projects\/micronaut-graphql\/tree\/master\/examples\/chat\" rel=\"nofollow\">chat application<\/a>. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430\u043c \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/www.graphql-java.com\/documentation\/master\/subscriptions\/\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e GraphQL Java<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u0441\u0442\u044b \u0434\u043b\u044f query \u0438 mutation \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Test fun testPlanets() {     val query = &quot;&quot;&quot;         {             planets {                 id                 name                 type                 details {                     meanRadius                     mass                     ... on InhabitedPlanetDetails {                         population                     }                 }             }         }     &quot;&quot;&quot;.trimIndent()      val response = graphQLClient.sendRequest(query, object : TypeReference&lt;List&lt;PlanetDto&gt;&gt;() {})      assertThat(response, hasSize(8))     assertThat(         response, contains(             hasProperty(&quot;name&quot;, `is`(&quot;Mercury&quot;)),             hasProperty(&quot;name&quot;, `is`(&quot;Venus&quot;)),             hasProperty(&quot;name&quot;, `is`(&quot;Earth&quot;)),             hasProperty(&quot;name&quot;, `is`(&quot;Mars&quot;)),             hasProperty(&quot;name&quot;, `is`(&quot;Jupiter&quot;)),             hasProperty(&quot;name&quot;, `is`(&quot;Saturn&quot;)),             hasProperty(&quot;name&quot;, `is`(&quot;Uranus&quot;)),             hasProperty(&quot;name&quot;, `is`(&quot;Neptune&quot;))         )     ) }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0441\u0442 query (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/test\/kotlin\/io\/graphqlfederation\/planetservice\/web\/QueryTests.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0447\u0430\u0441\u0442\u044c query \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 query, \u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0435\u0451 \u0432\u043e <a href=\"https:\/\/graphql.org\/learn\/queries\/#fragments\" rel=\"nofollow\">\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">private val planetFragment = &quot;&quot;&quot;     fragment planetFragment on Planet {         id         name         type         details {             meanRadius             mass             ... on InhabitedPlanetDetails {                 population             }         }     } &quot;&quot;&quot;.trimIndent()  @Test fun testPlanetById() {     val earthId = 3     val query = &quot;&quot;&quot;         {             planet(id: $earthId) {                 ... planetFragment             }         }          $planetFragment     &quot;&quot;&quot;.trimIndent()      val response = graphQLClient.sendRequest(query, object : TypeReference&lt;PlanetDto&gt;() {})      \/\/ assertions }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0441\u0442 Query \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/test\/kotlin\/io\/graphqlfederation\/planetservice\/web\/QueryTests.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/graphql.org\/learn\/queries\/#variables\" rel=\"nofollow\">variables<\/a>, \u0442\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Test fun testPlanetByName() {     val variables = mapOf(&quot;name&quot; to &quot;Earth&quot;)     val query = &quot;&quot;&quot;         query testPlanetByName(${'$'}name: String!){             planetByName(name: ${'$'}name) {                 ... planetFragment             }         }          $planetFragment     &quot;&quot;&quot;.trimIndent()      val response = graphQLClient.sendRequest(query, variables, null, object : TypeReference&lt;PlanetDto&gt;() {})      \/\/ assertions }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0441\u0442 Query \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/test\/kotlin\/io\/graphqlfederation\/planetservice\/web\/QueryTests.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0442. \u043a. \u0432 Kotlin \u0432 <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/basic-types.html#string-templates\" rel=\"nofollow\">raw strings<\/a>, \u0438\u043b\u0438 string templates, \u043d\u0435\u043b\u044c\u0437\u044f \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>$<\/code> (\u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 GraphQL) \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>${'$'}<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0436\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 <code>GraphQLClient<\/code> \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043a\u043e\u0434\u0430 \u0432\u044b\u0448\u0435 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/kotlin\/io\/graphqlfederation\/planetservice\/service\/GraphQLClient.kt\" rel=\"nofollow\">\u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441<\/a> (framework-agnostic \u0437\u0430 \u0441\u0447\u0451\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 OkHttp). \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 Java GraphQL \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/apollographql\/apollo-android\" rel=\"nofollow\">Apollo GraphQL Client for Android and the JVM<\/a>, \u043d\u043e \u044f \u0438\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 in-memory \u0411\u0414 H2 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c ORM Hibernate, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <code>micronaut-data-hibernate-jpa<\/code>. \u0411\u0430\u0437\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<h1>Auth service<\/h1>\n<p>  <\/p>\n<p>GraphQL \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/jwt.io\/\" rel=\"nofollow\">JWT<\/a>. Auth service \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u0432\u044b\u043f\u0443\u0441\u043a \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e JWT \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u0439 query \u0438 mutation:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">type Query {     validateToken(token: String!): Boolean! }  type Mutation {     signIn(data: SignInData!): SignInResponse! }  input SignInData {     username: String!     password: String! }  type SignInResponse {     username: String!     token: String! }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0421\u0445\u0435\u043c\u0430 Auth service (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/auth-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JWT, \u043d\u0430\u0434\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432 GraphQL IDE \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043c\u0443\u0442\u0430\u0446\u0438\u044e (Auth service \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e URL <code>http:\/\/localhost:8081\/graphql<\/code>):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mutation {   signIn(data: {username: &quot;john_doe&quot;, password: &quot;password&quot;}) {     token   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 JWT<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>Authorization<\/code> \u0445\u044d\u0434\u0435\u0440\u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 Altair \u0438 GraphQL Playground IDE) \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c; \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u044d\u0434\u0435\u0440\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>Bearer $JWT<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 JWT \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <code>micronaut-security-jwt<\/code>.<\/p>\n<p>  <\/p>\n<h1>Satellite service<\/h1>\n<p>  <\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">type Query {     satellites: [Satellite!]!     satellite(id: ID!): Satellite     satelliteByName(name: String!): Satellite }  type Satellite {     id: ID!     name: String!     lifeExists: LifeExists!     firstSpacecraftLandingDate: Date }  type Planet @key(fields: &quot;id&quot;) @extends {     id: ID! @external     satellites: [Satellite!]! }  enum LifeExists {     YES,     OPEN_QUESTION,     NO_DATA }  scalar Date<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0421\u0445\u0435\u043c\u0430 Satellite service (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432 \u0442\u0438\u043f\u0435 <code>Satellite<\/code> \u043f\u043e\u043b\u0435 <code>lifeExists<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u0441\u0435\u043a\u044c\u044e\u0440\u0435\u043d\u043e. \u041c\u043d\u043e\u0433\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043f\u043e\u0441\u043e\u0431, \u043a\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0440\u043e\u0443\u0442\u043e\u0432 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0451\u043d \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c GraphQL query\/mutation\/subscription \u0438\u043b\u0438 \u043f\u043e\u043b\u044f\u043c \u0442\u0438\u043f\u043e\u0432, \u0442. \u043a. \u0432\u0441\u0435 GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 <code>\/graphql<\/code>. \u0412\u0441\u0451, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0440\u0443 GraphQL-specific \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432 (\u0442\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u043b\u044e\u0431\u044b\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u044b):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">micronaut:   security:     enabled: true     intercept-url-map:       - pattern: \/graphql         httpMethod: POST         access:           - isAnonymous()       - pattern: \/graphiql         httpMethod: GET         access:           - isAnonymous()<\/code><\/pre>\n<p>  <\/p>\n<p><em>Security \u043a\u043e\u043d\u0444\u0438\u0433 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/resources\/application.yml\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 <code>DataFetcher<\/code>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0445\u0440\u0443\u043f\u043a\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class LifeExistsDataFetcher(     private val satelliteService: SatelliteService ) : DataFetcher&lt;Satellite.LifeExists&gt; {     override fun get(env: DataFetchingEnvironment): Satellite.LifeExists {         val id = env.getSource&lt;SatelliteDto&gt;().id         return satelliteService.getLifeExists(id)     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>LifeExistsDataFetcher<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/kotlin\/io\/graphqlfederation\/satelliteservice\/web\/graphql\/DataFetchers.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class SatelliteService(     private val repository: SatelliteRepository,     private val securityService: SecurityService ) {      \/\/ other stuff      fun getLifeExists(id: Long): Satellite.LifeExists {         val userIsAuthenticated = securityService.isAuthenticated         if (userIsAuthenticated) {             return repository.findById(id)                 .orElseThrow { RuntimeException(&quot;Can't find satellite by id=$id&quot;) }                 .lifeExists         } else {             throw RuntimeException(&quot;`lifeExists` property can only be accessed by authenticated users&quot;)         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>SatelliteService<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/kotlin\/io\/graphqlfederation\/satelliteservice\/service\/SatelliteService.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u043a\u0430\u0436\u0435\u0442\u0435 <code>Authorization<\/code> \u0445\u044d\u0434\u0435\u0440 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c JWT (\u0441\u043c. \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0440\u0430\u0437\u0434\u0435\u043b):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{   satellite(id: &quot;1&quot;) {     name     lifeExists   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0417\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u0421\u0435\u043a\u0440\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 (\u0432 Base64 \u0444\u043e\u0440\u043c\u0435):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">micronaut:   security:     token:       jwt:         enabled: true         signatures:           secret:             validation:               base64: true               # In real life, the secret should NOT be under source control (instead of it, for example, in environment variable).               # It is here just for simplicity.               secret: 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdA=='               jws-algorithm: HS256<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f JWT (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/resources\/application.yml\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0435\u043a\u0440\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445. \u0412\u043c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u043a\u0440\u0435\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e JWT (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>validateToken<\/code>, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435).<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u0435 \u0441\u043a\u0430\u043b\u044f\u0440\u044b \u043a\u0430\u043a <code>Date<\/code>, <code>DateTime<\/code> \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 GraphQL Java \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/graphql-java\/graphql-java-extended-scalars\" rel=\"nofollow\">graphql-java-extended-scalars<\/a> (<code>com.graphql-java:graphql-java-extended-scalars:$graphqlJavaExtendedScalarsVersion<\/code> \u0432 \u0431\u0438\u043b\u0434-\u0441\u043a\u0440\u0438\u043f\u0442\u0435). \u0417\u0430\u0442\u0435\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u043d\u0430\u0434\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0432 \u0441\u0445\u0435\u043c\u0435 (<code>scalar Date<\/code>) \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">private fun createRuntimeWiring(): RuntimeWiring = RuntimeWiring.newRuntimeWiring()     \/\/ other stuff     .scalar(ExtendedScalars.Date)     .build()<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043a\u0430\u043b\u044f\u0440\u0430 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/kotlin\/io\/graphqlfederation\/satelliteservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{   satelliteByName(name: &quot;Moon&quot;) {     firstSpacecraftLandingDate   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>Request<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"json\">{   &quot;data&quot;: {     &quot;satelliteByName&quot;: {       &quot;firstSpacecraftLandingDate&quot;: &quot;1959-09-13&quot;     }   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>Response<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0443\u0433\u0440\u043e\u0437\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 GraphQL API (\u0441\u043c. <a href=\"https:\/\/leapgraph.com\/graphql-api-security\" rel=\"nofollow\">\u0447\u0435\u043a\u043b\u0438\u0441\u0442<\/a> \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0441\u043b\u0438 \u0431\u044b \u0434\u043e\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439, \u0431\u044b\u043b \u0431\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0448\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{   planet(id: &quot;1&quot;) {     star {       planets {         star {           planets {             star {               ... # more deep nesting!             }           }         }       }     }   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440 \u201c\u0434\u043e\u0440\u043e\u0433\u043e\u0439\u201d query<\/em><\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c, \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>MaxQueryDepthInstrumentation<\/code>. \u0414\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 query \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 <code>MaxQueryComplexityInstrumentation<\/code>; \u043e\u043d\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <code>FieldComplexityCalculator<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u044f. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439 (\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 <code>FieldComplexityCalculator<\/code> \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439, \u2014 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0447\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0440\u0430\u0432\u043d\u0430 1):<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">return GraphQL.newGraphQL(transformedGraphQLSchema)     \/\/ other stuff     .instrumentation(         ChainedInstrumentation(             listOf(                 FederatedTracingInstrumentation(),                 MaxQueryComplexityInstrumentation(50, FieldComplexityCalculator { env, child -&gt;                     1 + child                 }),                 MaxQueryDepthInstrumentation(5)             )         )     )     .build()<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/kotlin\/io\/graphqlfederation\/satelliteservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u043a\u0430\u0436\u0435\u0442\u0435 <code>MaxQueryDepthInstrumentation<\/code> \u0438\/\u0438\u043b\u0438 <code>MaxQueryComplexityInstrumentation<\/code>, \u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 IDE, \u0442. \u043a. IDE \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <code>IntrospectionQuery<\/code>, \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c (\u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/graphql-java\/graphql-java\/issues\/1055\" rel=\"nofollow\">GitHub<\/a>). <code>FederatedTracingInstrumentation<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u0445 Apollo Gateway \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0440\u0435\u0441\u043f\u043e\u043d\u0441\u0430\u043c\u0438 (\u0434\u0430\u043b\u0435\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b <a href=\"https:\/\/www.apollographql.com\/docs\/graph-manager\/\" rel=\"nofollow\">Apollo Graph Manager<\/a>; \u043f\u043e\u0445\u043e\u0436\u0435, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430). \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043f\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <a href=\"https:\/\/www.graphql-java.com\/documentation\/master\/instrumentation\/\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e GraphQL Java<\/a>.<\/p>\n<p>  <\/p>\n<p>GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Micronaut:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton \/\/ mark it as primary to override the default one @Primary class HeaderValueProviderGraphQLExecutionInputCustomizer : DefaultGraphQLExecutionInputCustomizer() {      override fun customize(executionInput: ExecutionInput, httpRequest: HttpRequest&lt;*&gt;): Publisher&lt;ExecutionInput&gt; {         val context = HTTPRequestHeaders { headerName -&gt;             httpRequest.headers[headerName]         }          return Publishers.just(executionInput.transform {             it.context(context)         })     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440 <code>GraphQLExecutionInputCustomizer<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/kotlin\/io\/graphqlfederation\/satelliteservice\/web\/graphql\/HeaderValueProviderGraphQLExecutionInputCustomizer.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u0430\u0439\u0437\u0435\u0440 \u0434\u0430\u0451\u0442 <code>FederatedTracingInstrumentation<\/code> \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0445\u044d\u0434\u0435\u0440\u0430\u043c \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0440\u0438\u0448\u0451\u043b \u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442 Apollo Server \u0438\u043b\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0447\u0435\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u043d\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u044d\u0442\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u0438\u043d:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Singleton class CustomDataFetcherExceptionHandler : SimpleDataFetcherExceptionHandler() {      private val log = LoggerFactory.getLogger(this.javaClass)      override fun onException(handlerParameters: DataFetcherExceptionHandlerParameters): DataFetcherExceptionHandlerResult {         val exception = handlerParameters.exception         log.error(&quot;Exception while GraphQL data fetching&quot;, exception)          val error = object : GraphQLError {             override fun getMessage(): String = &quot;There was an error: ${exception.message}&quot;              override fun getErrorType(): ErrorType? = null              override fun getLocations(): MutableList&lt;SourceLocation&gt;? = null         }          return DataFetcherExceptionHandlerResult.newResult().error(error).build()     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/kotlin\/io\/graphqlfederation\/satelliteservice\/web\/graphql\/CustomDataFetcherExceptionHandler.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u2014 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0430\u044f GraphQL <em>\u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c<\/em> (<code>Planet<\/code>) \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 (\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435) \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u0438 \u0437\u0430\u0442\u0435\u043c \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 Apollo Server. \u0422\u0438\u043f <code>Planet<\/code> \u0440\u0430\u043d\u0435\u0435 \u0431\u044b\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0432 Planet service \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">type Planet @key(fields: &quot;id&quot;) {     id: ID!     name: String!     # from an astronomical point of view     type: Type!     isRotatingAroundSun: Boolean! @deprecated(reason: &quot;Now it is not in doubt. Do not use this field&quot;)     details: Details! }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>Planet<\/code> \u0432 Planet service (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/planet-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>Satellite service \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 <code>Planet<\/code> \u043f\u043e\u043b\u0435 <code>satellites<\/code> (\u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0435\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f non-nullable \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e non-nullable \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">type Satellite {     id: ID!     name: String!     lifeExists: LifeExists!     firstSpacecraftLandingDate: Date }  type Planet @key(fields: &quot;id&quot;) @extends {     id: ID! @external     satellites: [Satellite!]! }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>Planet<\/code> \u0432 Satellite service (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/resources\/schema.graphqls\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 Apollo Federation <code>Planet<\/code> \u2014 \u044d\u0442\u043e <em>entity<\/em> \u2014 \u0442\u0438\u043f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 Satellite service, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 <em>stub<\/em> \u0434\u043b\u044f \u0442\u0438\u043f\u0430 <code>Planet<\/code>). \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>@key<\/code> \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 \u0442\u0438\u043f\u0430. \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <code>@extends<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0438\u043f <code>Planet<\/code> \u2014 \u044d\u0442\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0430\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 Planet service). \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f\u043c Apollo Federation \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/federation\/core-concepts\/\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Apollo<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Apollo Federation; \u043e\u0431\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 GraphQL Java, \u043d\u043e \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/ExpediaGroup\/graphql-kotlin\" rel=\"nofollow\">GraphQL Kotlin<\/a><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 Kotlin \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 code-first \u043f\u043e\u0434\u0445\u043e\u0434 (\u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443). \u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <code>graphql-kotlin-federation<\/code>, \u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u043ec\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/apollographql\/federation-jvm\" rel=\"nofollow\">Apollo Federation on the JVM<\/a><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0434\u0451\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u044f\u043b\u043e \u0438 API \u043c\u043e\u0433 \u0431\u044b \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u043e\u0442\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u0442\u043e\u0440\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f API; \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/rkudryashov\/graphql-java-federation\" rel=\"nofollow\">GitHub<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 <code>Planet<\/code> \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>FederatedEntityResolver<\/code> (\u043f\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443, \u043e\u043d \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0435\u043c \u0437\u0430\u043f\u043e\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u0435 <code>Planet.satellites<\/code>); \u0434\u0430\u043b\u0435\u0435 \u044d\u0442\u043e\u0442 \u0440\u0435\u0437\u043e\u043b\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 <code>FederatedSchemaBuilder<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Bean @Singleton fun graphQL(resourceResolver: ResourceResolver): GraphQL {      \/\/ other stuff      val planetEntityResolver = object : FederatedEntityResolver&lt;Long, PlanetDto&gt;(&quot;Planet&quot;, { id -&gt;         log.info(&quot;`Planet` entity with id=$id was requested&quot;)         val satellites = satelliteService.getByPlanetId(id)         PlanetDto(id = id, satellites = satellites.map { satelliteConverter.toDto(it) })     }) {}      val transformedGraphQLSchema = FederatedSchemaBuilder()         .schemaInputStream(schemaInputStream)         .runtimeWiring(createRuntimeWiring())         .federatedEntitiesResolvers(listOf(planetEntityResolver))         .build()      \/\/ other stuff }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0438\u043d\u0430 \u0442\u0438\u043f\u0430 GraphQL \u0432 Satellite service (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/satellite-service\/src\/main\/kotlin\/io\/graphqlfederation\/satelliteservice\/web\/graphql\/GraphQLFactory.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 query (<code>_service<\/code> and <code>_entities<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b Apollo Server. \u042d\u0442\u0438 query \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430\u0440\u0443\u0436\u0443 Apollo Server\u2019\u043e\u043c. \u0421\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 Apollo Federation \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0432 standalone-\u0440\u0435\u0436\u0438\u043c\u0435. API \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<p>  <\/p>\n<h1>Apollo Server<\/h1>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/\" rel=\"nofollow\">Apollo Server<\/a> \u0438 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/federation\/introduction\/\" rel=\"nofollow\">Apollo Federation<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0434\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0446\u0435\u043b\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a GraphQL \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c \u0434\u043b\u044f \u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432<\/p>\n<p>  <\/li>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0435\u0442\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0434\u043b\u044f frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0447\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u2014 <a href=\"https:\/\/www.apollographql.com\/docs\/graphql-tools\/schema-stitching\/\" rel=\"nofollow\">schema stitching<\/a> \u2014 \u043d\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 Apollo \u043e\u043d \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a deprecated. \u041e\u0434\u043d\u0430\u043a\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0430\u044f \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434: <a href=\"https:\/\/github.com\/graphql-java\/nadel\" rel=\"nofollow\">Nadel<\/a>. \u041e\u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044f\u043c\u0438 GraphQL Java \u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u0441 Apollo Federation; \u044f \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">{   &quot;name&quot;: &quot;api-gateway&quot;,   &quot;main&quot;: &quot;gateway.js&quot;,   &quot;scripts&quot;: {     &quot;start-gateway&quot;: &quot;nodemon gateway.js&quot;   },   &quot;devDependencies&quot;: {     &quot;concurrently&quot;: &quot;5.1.0&quot;,     &quot;nodemon&quot;: &quot;2.0.2&quot;   },   &quot;dependencies&quot;: {     &quot;@apollo\/gateway&quot;: &quot;0.12.0&quot;,     &quot;apollo-server&quot;: &quot;2.10.0&quot;,     &quot;graphql&quot;: &quot;14.6.0&quot;   } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041c\u0435\u0442\u0430-\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u043e\u0435 (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/apollo-server\/package.json\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const {ApolloServer} = require(&quot;apollo-server&quot;); const {ApolloGateway, RemoteGraphQLDataSource} = require(&quot;@apollo\/gateway&quot;);  class AuthenticatedDataSource extends RemoteGraphQLDataSource {     willSendRequest({request, context}) {         request.http.headers.set('Authorization', context.authHeaderValue);     } }  const gateway = new ApolloGateway({     serviceList: [         {name: &quot;auth-service&quot;, url: &quot;http:\/\/localhost:8081\/graphql&quot;},         {name: &quot;planet-service&quot;, url: &quot;http:\/\/localhost:8082\/graphql&quot;},         {name: &quot;satellite-service&quot;, url: &quot;http:\/\/localhost:8083\/graphql&quot;}     ],     buildService({name, url}) {         return new AuthenticatedDataSource({url});     }, });  const server = new ApolloServer({     gateway, subscriptions: false, context: ({req}) =&gt; ({         authHeaderValue: req.headers.authorization     }) });  server.listen().then(({url}) =&gt; {     console.log(` Server ready at ${url}`); });<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 Apollo Server (<a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\/blob\/master\/apollo-server\/gateway.js\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043f\u0440\u043e\u0449\u0451\u043d (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0447\u0430\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0445\u044d\u0434\u0435\u0440\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438); \u0435\u0441\u043b\u0438 \u0442\u0430\u043a, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435 (\u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>Authorization<\/code> \u0445\u044d\u0434\u0435\u0440 \u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435). \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e security, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 JWT \u0438\u0437 \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <code>apollo-server<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b 3 GraphQL Java \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u043d\u0435\u0435, <code>cd<\/code> \u0432 \u043f\u0430\u043f\u043a\u0443 <code>apollo-server<\/code>, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">npm install npm run start-gateway<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[nodemon] 2.0.2 [nodemon] to restart at any time, enter `rs` [nodemon] watching dir(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting `node gateway.js` \ufffd Server ready at http:\/\/localhost:4000\/ [INFO] Sat Feb 15 2020 13:22:37 GMT+0300 (Moscow Standard Time) apollo-gateway: Gateway successfully loaded schema.         * Mode: unmanaged<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041b\u043e\u0433 \u0441\u0442\u0430\u0440\u0442\u0430 Apollo Server<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u043e \u0432\u0441\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/e9\/z4\/2u\/e9z42udpzq8r8wxposqsgaxfavc.png\" alt=\"altair apollo server\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <code>http:\/\/localhost:4000\/playground<\/code> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Playground IDE.<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0438 query \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>MaxQueryComplexityInstrumentation<\/code> \u0438\/\u0438\u043b\u0438 <code>MaxQueryDepthInstrumentation<\/code> \u0441 \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, GraphQL IDE \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e Apollo Server \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 query <code>{ _service { sdl } }<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 <code>IntrospectionQuery<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044f \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p>subscription\u2019\u044b <a href=\"https:\/\/github.com\/apollographql\/apollo-server\/issues\/3357\" rel=\"nofollow\">\u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f<\/a> Apollo Gateway\u2019\u0435\u043c (\u043d\u043e \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 standalone GraphQL Java \u0441\u0435\u0440\u0432\u0438\u0441\u0435)<\/p>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 Planet service \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e <code>.excludeSubscriptionsFromApolloSdl(true)<\/code>.<\/p>\n<p>  <\/li>\n<li>\n<p>\u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u043f\u044b\u0442\u0430\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c GraphQL \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, <a href=\"https:\/\/github.com\/apollographql\/apollo-server\/issues\/2849\" rel=\"nofollow\">\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0435\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f\u0445<\/a><\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435\/\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 downstream \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u0434 Apollo Server\u2019\u043e\u043c, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/federation\/federation-spec\/\" rel=\"nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e Federation<\/a>; \u0441\u043f\u0438\u0441\u043e\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u044d\u0442\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/federation\/other-servers\/\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Apollo<\/a>.<\/p>\n<p>  <\/p>\n<h1>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 GraphQL \u043d\u0430 JVM. \u0422\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c API \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 GraphQL Java \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u043e\u0433\u043e GraphQL API; \u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438. \u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0441\u0447\u0451\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Apollo Server, Apollo Federation \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/rkudryashov\/graphql-java-federation\" rel=\"nofollow\">graphql-java-federation<\/a>. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/rkudryashov\/graphql-federation\" rel=\"nofollow\">GitHub<\/a>. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<p>  <\/p>\n<h1>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>  <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/graphql.org\/\" rel=\"nofollow\">graphql.org<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/spec.graphql.org\/\" rel=\"nofollow\">spec.graphql.org<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/graphql.org\/learn\/best-practices\/\" rel=\"nofollow\">graphql.org\/learn\/best-practices<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/www.graphql-java.com\/\" rel=\"nofollow\">graphql-java.com<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/micronaut-projects.github.io\/micronaut-graphql\/latest\/guide\/\" rel=\"nofollow\">Micronaut GraphQL Integration<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/www.graphql-java.com\/tutorials\/getting-started-with-spring-boot\/\" rel=\"nofollow\">Getting started with GraphQL Java and Spring Boot<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/www.howtographql.com\/\" rel=\"nofollow\">howtographql.com<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/chentsulin\/awesome-graphql\" rel=\"nofollow\">Awesome GraphQL<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/graphql-java\/awesome-graphql-java\" rel=\"nofollow\">Awesome GraphQL Java<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/APIs-guru\/graphql-apis\" rel=\"nofollow\">Public GraphQL APIs<\/a><\/p>\n<p>  <\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/apollographql\/federation-demo\" rel=\"nofollow\">Apollo Federation demo<\/a><\/p>\n<p>  <\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/490002\/\"> https:\/\/habr.com\/ru\/post\/490002\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/490002\/\">\n<p><a href=\"https:\/\/graphql.org\/\" rel=\"nofollow\">GraphQL<\/a> \u2014 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 Facebook. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 GraphQL API \u043d\u0430 JVM, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044f\u0437\u044b\u043a\u0430 Kotlin \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/micronaut.io\/\" rel=\"nofollow\">Micronaut<\/a>; \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 Java\/Kotlin \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445. \u0417\u0430\u0442\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e GraphQL \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u043e \u0432\u0441\u0435\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/\" rel=\"nofollow\">Apollo Server<\/a> \u0438 <a href=\"https:\/\/www.apollographql.com\/docs\/apollo-server\/federation\/introduction\/\" rel=\"nofollow\">Apollo Federation<\/a>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ib\/hf\/zb\/ibhfzb4v5pkcm3bmnencdcamyym.png\" alt=\"architecture\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-299303","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=299303"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299303\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}