A simple demonstration of two Spring Boot microservices GraphQL powered for Distributed Edge programming exam.
We have two microservices:
- Product-service for product retrieval, insertion and deletion (it exposes getProduct, createProduct and deleteProduct) and for product retrieval, insertion and deletion along with reviews (it exposes getProductAggregate (it shows product and reviews), createProductAggregate (it creates product with review) and deleteProductAggregate (it delete everything related to product)).
- Review-service for review retrieval, insertion and deletion (it exposes getReviews, createReviews and deleteReviews).
Inside the microservices there are been left REST APIs for the same operations, but they are not used in the project (useful just to do comparisons with GraphQL).
Because of the nature of the GraphQL language, there is no OpenAPI-like documentation for the endpoints; available queries and mutations can be retrieved by quering the GraphQL endpoints via an appropriate client, such as Postman. Anyway, further details on GraphQL can be found here.
All microservices are composed by three layer:
- Protocol layer: it exposes APIs to the users.
- Service layer: it implements the interfaces written in protocol layer.
- Persistence layer: to save data into mongodb.
- Interface layer: it contains the interfaces for the service layer.
- Exceptions & http layers: they contain the exceptions and http error managing for the service layer.