Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GraphQL at Twitter

GraphQL at Twitter

George Leontiev

February 21, 2019
Tweet

More Decks by George Leontiev

Other Decks in Technology

Transcript

  1. A federated database brings together multiple data sources so that

    they can be queried and mutated uniformly.
  2. Column({ name = "User/birthday", source = DbColumn({ dest = "twitter_db",

    dataset = "birthdays", mapping = KeyValue({ key = Type(Long), // User ID value = Type(Long) // Timestamp }) }) })
  3. Column({ name = "User/birthday", source = DbColumn({ dest = "twitter_db",

    dataset = "birthdays", mapping = KeyValue({ key = Type(Long), // User ID value = Type(Long) // Timestamp }) }), graphql = Field("User", "birthday") })
  4. Clients subscribe to an event with a GraphQL query and

    receive payloads. — Laney Kuenzel
  5. { "query": "subscription { random_tweet { id } }", "event":

    { "type": "random_tweet", "tweet_id": "..." }, "user": { "id": "12" } }
  6. subscription { random_tweet { __typename ... on Status { topic

    } ... on Tweet { id text } } } { "data": { "random_tweet": { "__typename": "Status", "topic": "graphql/sM_xI92k" } } }
  7. { "topic": "graphql/sM_xI92k", "payload": { "data": { "random_tweet": { "__typename":

    "Tweet", "id": "...", "text": "..." } } } } POST /subscribe?topic= graphql/sM_xI92k Live Pipeline
  8. Subscriptions API Live Pipeline EventBus subscription { random_tweet { ...

    } } { "topic": "graphql/sM_xI92k", "payload": { "data": { "random_tweet": { ... } } } } { "random_tweet_id": "..." } { ... "topic": "graphql/sM_xI92k" ... } Event Producer
  9. { user(id: "12") { name followers { name followers {

    name followers { name followers { name } } } } } }
  10. enabling technology noun An invention or innovation, that can be

    applied to drive radical change in the capabilities of a user or culture. Enabling technologies are characterized by rapid development of subsequent derivative technologies, often in diverse fields.
  11. adjacent possible noun A kind of shadow future, hovering on

    the edges of the present state of things, a map of all the ways in which the present can reinvent itself.