eren arslan
eren arslan

Reputation: 207

Microservices store User info between services

For example I have a post service. At UI I need to show post and userinfo (username and id for redirect to user page)

Options:

  1. Should I store username and id in post service. (When every user register to system I will send subset detail to post service via RabbitMQ). (Total Request from UI= 1)

  2. I will store only Id of user(AR). And at UI component fetch user with id(Total Request from UI=2)

Upvotes: 0

Views: 1010

Answers (1)

Kirin Yao
Kirin Yao

Reputation: 1636

Both of them are OK. The decision is based on how you map the concepts between different boundary contexts. The patterns are:

  • Anticorruption Layer
  • Shared Kernel
  • Open Host Service(option 2)
  • Separate Ways
  • Customer Supplier
  • Conformist
  • Partenership
  • Published Language
  • ...

It is not only the personal preference, but also about the organization structure(The Conway's Law).

If both the two contexts(post and user) are controlled by your team, you could choose either of them. Considering the complexity of the option 1, I prefer option 2 since it's very straight. Start from the easier one then involve your architecture is always a good idea.

Upvotes: 2

Related Questions