Reputation: 507
I'm creating a system using CQRS and Event Sourcing pattern (I hope so). I have to make a business decision dependent on statistics data stored by one read model and user setting data stored by different read model (both created by events in the past). What is a good place to put business logic rules that outcome of which depends on that data?
Is it a command (can I fetch data stored in read models in command)?
Other abstraction layer, like saga?
Upvotes: 0
Views: 330
Reputation: 16348
Your business model should work only with the business model. You need a 'read' model but specific for the business side. This is not the same query/read model used for UI, reporting. Business logic rules are always part of the business layer, the command part. They can be part of a business object or a service (which usually is a command handler).
A command is just a dto containing input data. It shouldn't contain any business rules.
Saga is the name of a long running (asynchronus) process, it isn't an abstraction layer, or any layer.
Upvotes: 2