Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microservice Patterns and Best Practices

You're reading from   Microservice Patterns and Best Practices Explore patterns like CQRS and event sourcing to create scalable, maintainable, and testable microservices

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781788474030
Length 366 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Vinicius Feitosa Pacheco Vinicius Feitosa Pacheco
Author Profile Icon Vinicius Feitosa Pacheco
Vinicius Feitosa Pacheco
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Understanding the Microservices Concepts FREE CHAPTER 2. The Microservice Tools 3. Internal Patterns 4. Microservice Ecosystem 5. Shared Data Microservice Design Pattern 6. Aggregator Microservice Design Pattern 7. Proxy Microservice Design Pattern 8. Chained Microservice Design Pattern 9. Branch Microservice Design Pattern 10. Asynchronous Messaging Microservice 11. Microservices Working Together 12. Testing Microservices 13. Monitoring Security and Deployment 14. Other Books You May Enjoy

From domain to entity

Given the domains that we have in our application, it is time to define the entities. When we speak of entities microservices it is important to note that any transactional need among microservices can mean a design error.

A process asynchronous message by the broker can be used to sanitize the database, but that does not mean that there is a transaction. Trying to establish a type of transaction between microservices that are completely separated may be a big mistake.

Our old application had the following entities:

  • News:
    • ID – UniqueID
    • Author – FK user_id
    • Title
    • Description
    • Content
    • Labels – News subjects
    • Type – New type (Sports, Famous, Politics)
    • CreatedAt
    • UpdatedAt
    • PublishedAt
  • Recommendations:
    • Label
    • user_id
  • Users:
    • ID
    • Name
    • Email

In addition to these entities, there is a range of tables that complement the user's information for the purpose of providing permissions and access permissions.

With the transformation of monolithic architecture for microservices architecture, the data model and design of these entities will also change.

First, we know that all the news segments will not be unique. This implies the removal of the Type:

  • News Service:
    • ID
    • Author
    • Title
    • Description
    • Content
    • Labels
    • CreatedAt
    • UpdatedAt
    • PublishedAt

Another change is that users will no longer have the responsibility for authentication and authorization.

You have been reading a chapter from
Microservice Patterns and Best Practices
Published in: Jan 2018
Publisher: Packt
ISBN-13: 9781788474030
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image