3. A few words about @jefrajames
Speaker me = SpeakerOf.setLastName(“James”)
.setFirstName(“Jean-François”)
.setBackground(Period.ofYears(33))
.setCompany(“Worldline”)
.setLocation(“France”)
.addSkill(“Software Architecture”, Year.parse (“1990”))
.addSkill(“Java”, Year.parse (“1997”));
4. A few requests about @theJiBz
Let’s go to http://localhost:4000/ !
7. GraphQL – But a new way to design API !
Facebook introduced GraphQL at their Reactjs
conference in 2015.
GraphQL is a query language and runtime
that we can use to build and expose APIs as a
strongly-typed schema instead of hundreds of
REST endpoints.
Your clients see the schema. They write a query
for what they want. They send it over and get
back exactly the data they asked for and
nothing more.
Spec: https://facebook.github.io/graphql/draft/
8. GraphQL – A bit of history and context
SOAP –
Server to Server
Data contract
Strict (wsdl)
Static (backend)
Payload
Heavy (XML, bindings,
ports, services …)
REST API –
Web to Server
Data contract
Permissive (http)
Static (backend)
Payload
Average (CRUD style APIs)
GraphQL –
Mobile to Server
Data contract
Strict (schema)
Evolutive (gateway)
Payload
Small (Get Just What
You Asked for)
9. GraphQL – PROS / CONS
Pros
• Network efficiency
• Lose coupling between
client and server
• Strong typing
• Live contract
Cons
• Young ecosystem
• Gateway-side
complexity
• No full usage of HTTP
• Client-side handling of
partial responses
10. • Mobile/Multifront usage as the golden use case
• Graph-oriented datasources
• Unifying multiple datasources
=> « Soap is undead, REST is alive and GraphQL just born »
GraphQL – To sum it up
11. GraphQL in the Java Ecosystem
graphql-java
schema initialization (DSL, API), query execution
Rel: 11.0, Oct 2018
graphql-java-tools
schema-first
Rel: 5.4.1, Nov 2018
spqr
code-first
Rel: 0.9.9, Dec 2018
graphql-java-servlet
HTTP transport
Rel: 7.2.0, Feb 2018
OR AND
12. Schema-first vs code-first
Schema
DSL
written
Java class
Java class
Java classSpecialized
Java class
GraphQLRootResolver
GraphQLResolver<>
GraphQLScalarType
Etc …
Annotated
Java class
Annotated
Java class
Annotated
Java class
Annotated
Java class
@GraphQLQuery
@GraphQLMutation
@GraphQLArgument
@GraphQLInputField
Etc …
schema-first code-first
13. From Java EE to Jakarta EE
The follow up of Java EE
The new brand name
New governance model and
specification process in place
Started in 2016
In reaction to Java EE inertia
Focus on Microservices
Eclipse project
Dynamic and innovative
An incubator for Jakarta EE
Previously Java EE Ref. Impl.
Now an Eclipse Project
5.1 released in Jan 2019
First Jakarta EE version
Java EE 8 certified
More on Payara blog
Eclipse top-level project
About 40 subprojects
TCK, Spec, Implementations
From Oracle to Eclipse
13.5 million lines of code
95k files
About 400 IP reviews
15. • The first new Jakarta EE specification
• To streamline integration of NoSQL databases
• Supporting all database models: Key-Value, Document, Column, Graph, Hybrid
• In a consistent way
• Leveraging an existing solution:
Moving forward Jakarta EE NoSQL
18. • Training exercise, in the context of MicroProfile GraphQL initiative
• Available on GitHub, detailed in a blog post
• Also an opportunity:
– To test GlassFish 5.1
– To check portability on other application servers
– To test JNoSQL
About the demo project-Why?
Graph
QL
19. • Starting from the graphql-java-tutorial from Bojan Tomic
• Switching from schema-first to code-first
• Maximum CDI use, minimum graphql-servlet use
• Plus JNoSQL in the picture
About the demo project-How?
24. • CDI beans everywhere: repositories, GraphQL classes, AuthContext
• Generic CDI extension to create the schema
• Plus a specific @GraphQLComponent CDI stereotype
• Schema dynamically generated at application startup
CDI integration
25. • DocumentCollectionManager CDI producer required
• Use of JNoSQL template enabling select, insert and singleResult operations
• JNoSQL annotations on domain objects: @Entity, @Id, @Column,
• Real simplification for the developer
JNoSQL integration
26. • Started in Dec. 2018
• Creating a specification-based, easy to use, annotation-based API around CDI,
JSON-P and JSON-B for GraphQL
• The initial goal would be to create a code-first approach (similar to JAX-RS)
• Following the "code-first approach", We propose to leverage existing solutions.
The content proposed is heavily influenced by GraphQL SPQR.
MicroProfile GraphQL-What for?
27. MicroProfile GraphQL-Who are we?
Andy McCright (IBM)
Phillip Kruger (Red Hat)
Jean-Baptiste Roux (Worldline)
Bojan Tomic (ServiceNow, spqr)
Jean-François James (Worldline)
Adam Anderson (IBM)
You are welcome!