Hi all
We’re exploring the idea of moving our architecture to an event-sourced + CQRS model. It sounds like a very interesting approach and I’m working on a POC currently. Our SaaS is in the productivity space and we have around 15 microservices that we are refactoring/rewriting.
We like the idea of having a built-in history to analyze user behavior and especially to have one source of truth to generate multiple read models.
1. Eventstoredb per Microservice
Is the common setup to have an event-store instance per microservice? This would allow for loose coupling, but I assume that for HA, we would require 15 x 3 = 45 instances of Eventstoredb?
2. Multi-Tenant Stream Naming Convention
I read on the forum that a “stream per instance” is the recommended way. In our soft multi-tenant infrastructure, would this mean that our stream naming convention could look something like this {backend-id}-{service-id}-{tenant-id}-{instance-id}
= todoApp-tenantService-tenant1-task2345
(could use business domain instead of micro-service-id). And for each new todo-task we would create a new stream.
3. Generating Read Model
While I’m able to create events in streams, I am struggling with creating a read model out of a stream. What is the way to go? We use Typescript and I think that I need to write some sort of event handler that takes the event, parses it and writes it into the read model. And for each read model I need to create new handlers?
4. Event Source everywhere?
It sounds great to have the benefits of event sourcing, but is it recommended to use that model in the entire architecture in favor or “regular” microservice approaches (without CQRS / ES)?
Thanks and kind regards