❔ Event-Sourcing for a Duplicated Topic between Two MicroServices
@Architecture
Hi friends,
I'm working on a project using
Microservices
architecture, I have AuthService
, ExpenseService
and EventSourcererService
, the last one is used as a separated service for Event-Sourcing for all other services.
The AuthService
is responsible about the User
management, it contains a table/entity called User
.
In the ExpenseService
I need some user's data to be stored in another table inside this service's DB called User
, and this data should be the same as in the User
of the AuthService
.
Oncourse I use the RabbitMQ
as the asynchronous communication between my services.
In the EventSourcererService
every table/entity in every other services will event-sourced ( their events will stored in the EventSourcererService
's DB).
Now the duplicated topic here is the User
in the AuthService
which the original, and the User
in the ExpenseService
.
The Issue:
I'm a bit confusing about should I continue with the same flow/method ( every table in every service should have its equivalent events table in the EventSourcererService
including the booth users tables in both services) OR create only the event-sources table for only the User
of the AuthService
OR is there another good approach ?
Please I need an experience share from you and massive thanks in advance <37 Replies
I would have all of the services share a single database.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Sorry for the late, could you please provide a brief reason ?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.It's simple, easy to implement and removes entire classes of engineering problems such as how to ensure multiple databases stay in sync. It's also a time-tested design that has been the normal approach for 30+ years.
I think a more relevant question would be: what possible benefit does having multiple databases bestow, other than making everything harder?
There are times for multiple databases: geo-replication being one, sharding due to extreme scale being another.
In general, though, I don't know why you would want to go down that route.
First of I really appreciate your time and answer,
To be clear I go down to that route ( multiple databases ) because this is a project that I want to add into my portfolio as one of advanced projects I worked on, so the new adventure for me that I never worked on before is Microservices with isolated/multiple databases also an isolated Microservice for Event-sourcing is one of the approaches that I never worked on before.
Hope you understand and if you have any suggestions or recommendations please feel free and share your experience with me
Massive thanks in advance
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.