I’m implementing a restaurant management micro-service using CQRS pattern.
The read and write databases are separated and eventually become consistent by async events using an event bus.
Now I want to create an Authorization policy that checks if the current user is a restaurant owner or not. I didn’t want to query the identity service for current roles because this seems to be responsibility of restaurant domain, and I also don’t want to be coupled to the identity service by using sync API calls.
-
Now the problem is that how I should fetch the data?
Should I always use the write database?Or I should implement two policies for queries and commands, where the query controller uses read database and the write controller will use write database.
-
How should I handle the eventually consistency issue at the read side?