- Mastering Microservices with Java
- Sourabh Sharma
- 371字
- 2021-07-02 13:03:40
Developing and implementing microservices
We will use the domain-driven implementation and approach we described in the last chapter to implement the microservices using Spring Cloud. Let's revisit the key artifacts:
- Entities: These are categories of objects that are identifiable and remain the same throughout the states of the product/services. These objects are not defined by their attributes, but by their identities and threads of continuity. Entities have traits such as identity, a thread of continuity, and attributes that do not define their identity.
- Value objects (VOs): These just have the attributes and no conceptual identity. A best practice is to keep VOs as immutable objects. In the Spring Framework, entities are pure POJOs; therefore, we'll also use them as VOs.
- Service objects: These are common in technical frameworks. These are also used in the domain layer in DDD. A service object does not have an internal state; the only purpose of it is to provide the behavior to the domain. Service objects provide behaviors that cannot be related with specific entities or VOs. Service objects may provide one or more related behaviors to one or more entities or VOs. It is a best practice to define the services explicitly in the domain model.
- Repository objects: A repository object is a part of the domain model that interacts with storage, such as databases, external sources, and so on, to retrieve the persisted objects. When a request is received by the repository for an object reference, it returns the existing object reference. If the requested object does not exist in the repository, then it retrieves the object from storage.
Downloading the example code: A detailed explanation of how to download the code bundle is in the preface of this book. Please have a look. The code bundle for this book is also hosted on GitHub at https://github.com/PacktPublishing/Mastering-Microservices-with-Java-Third-Edition. We also have other code bundles from our rich catalog of books and videos, which are available at https://github.com/PacktPublishing/. Check them out!
Each OTRS microservice API represents a RESTful web service. The OTRS API uses HTTP verbs such as GET, POST, and so on, and a RESTful endpoint structure. Request and response payloads are formatted as JSON. If required, XML can also be used.
推薦閱讀
- JavaScript前端開發(fā)模塊化教程
- Ext JS Data-driven Application Design
- Web Application Development with R Using Shiny(Second Edition)
- Production Ready OpenStack:Recipes for Successful Environments
- Python程序設(shè)計案例教程
- 精通Python自然語言處理
- Flux Architecture
- 數(shù)據(jù)結(jié)構(gòu)案例教程(C/C++版)
- R語言與網(wǎng)絡輿情處理
- 動手學數(shù)據(jù)結(jié)構(gòu)與算法
- 軟件項目管理實用教程
- Mastering Docker
- UI設(shè)計基礎(chǔ)培訓教程(全彩版)
- Oracle 12c從入門到精通(視頻教學超值版)
- Getting Started with Windows Server Security