Microservices with Clojure
上QQ阅读APP看书,第一时间看更新

Isolating services by persistence

In the existing monolithic application of Helping Hands, the consumers and providers database tables are accessed by all the core components of the system, as shown in the following diagram. These tables are prime candidates for being wrapped around a service and isolated in a separate database that is accessible only to the corresponding service directly. All other services must talk to the Service Consumer service and the Service Provider service for any details instead of directly accessing the consumers and providers databases.

Since there is a separate service created to handle the requests for consumers and providers, there is no need to have a service corresponding to the Registration Component. The Service Consumer service and Service Provider service can now handle all the requests to register, modify, or delete consumers and providers, respectively. Similarly, the service and order services can now handle all the requests related to services and orders, respectively, by isolating the corresponding databases. The order service can now talk to Service Consumer, Service Provider, and Service to get the required details for the order.

The Helping Hands application will be using a combination of the Datomic ( http://www.datomic.com/) and Elasticsearch ( https://www.elastic.co/products/elasticsearch) databases for various microservices. Part-3 of this book discusses the persistence layer in detail, and the last chapter of Part-2 introduces Datomic .