public BankAccount() { _state = null; _logger = Context.GetLogger(); Receive <OpenBankAccount>(Handle); Receive <GetBankAccountState>(Handle); }
private bool Handle(OpenBankAccount command) { _state = new BankAccountState( command.Id, command.Savings, command.Credit); _logger.Info("Opened Bank Account for Id={0}", command.Id); return(true); }
private bool Handle(GetBankAccountState query) { var result = new BankAccountState( _state.UserId, _state.Savings, _state.Credit); Sender.Tell(result); _logger.Info("Query for Bank Account State returned for Id={0}", query.Id); return(true); }