Horusiath / AkkaCQRS

Event sourcing example build on Akka.NET with persistence plugin
MIT License
102 stars 34 forks source link

Withdrawal method #7

Open varghesep opened 9 years ago

varghesep commented 9 years ago

I think the method PatchWithdrawal should return an object which should contain the account and balance. Or another GET method to return an account which shows the balance.

Code snippet: public async Task PatchWithdrawal(Withdraw request)

Do you have any thoughts on where to incorporate this?

Horusiath commented 9 years ago

The essence of CQRS is to separate reads and writes. For this reason I think it's not necessary to return an updated read model as result of the request. It can be send separately i.e. using SignalR hubs connected to actor system.

But of course, when your design represents another characteristics, you can simply send updated part of the read model back to command sender.

varghesep commented 9 years ago

I think it make sense to call PatchWithdrawal but not return the balance. We can have another message sent to an actor to return the Balance.

I assume the Account (public class Account : AggregateRoot) actor is purely for the write purpose.

If so, is AccountHistoryView \ the actor where that message can be sent? Or it should be the AccountService** which is not complete yet? Or should be another actor?