mercredi 8 février 2017

Should single microservice be both public and internal simultaneulsy

There are three microservices in place:

Authors
which have ability to SELECT and CRUD entity "author"

Books
which have ability to SELECT and CRUD entity "book"

Mobile app host
build especially for mobile client to respond with full data model requested, so that mobile app would not 'enrich' data on it's end.
Ex. API 'MobileHost.getAllBooksOfGivenAuthor' will respond with both author name and book names, by calling 'Authors.getAuthorData(authorId)' and merging it's data with 'Books.getBooksByAuthorIds(authorId)' resulting with a structure like this:

{ 
  "author" : {
    "name" : "Winner",
    "id" : 1
  },
  "books" : [
     {
       "name" : "Book A",
       "id" : "13231231"
     }
   ]
}

Question is following:
If mobile client reads data through "Mobile app host" should it do "add author" through "Mobile app host" also, or it's ok to contact directly "Authors" service? Should CRUD be proxied in such case or not?

Aucun commentaire:

Enregistrer un commentaire