-
Book Overview & Buying
-
Table Of Contents
Building Microservices with Micronaut®
By :
The DTO pattern originates from the enterprise application architecture and fundamentally, data objects aggregate and encapsulate the data to transfer. Since in the microservices architecture an end client may need varied data from different persistence resources (such as invoice data along with user data), the DTO pattern is very effective in limiting calls to microservices for getting the desired projection of data. DTOs are also known as assembler objects since they assemble data from multiple entity classes.
In this section, we will explore how to implement and map (to an entity) DTOs. In the later sections, we will further dive into using DTOs as an effective mechanism to transfer data from and into a microservice. We will also look at how DTOs can help reduce the number of calls to microservices by assembling data.
To implement a DTO, we will begin defining a DTO class for the pet owner.
Open the pet-owner microservice...