Consider an actor ‘BankAccount’ which receives messages:


   - Deposit(amount, branchName, time)
   - Withdraw(amount, branchName, time)
   - GetBalance

Within the actor, I only keep the balance as part of the state. The 
branchName (which is the branch of the bank) and time (time when the 
request was made) does not affect the actor’s state since it does not 
affect the balance.

I want to save all Deposit and Withdraw transactions to a SQL database — 
the amount, branchName, time as well as whether or not the transaction was 
successful or not. (Withdraw may fail if there’s not enough balance.) I do 
not need to save GetBalance requests.

Every end of day, I want to save the user’s balance to a different table on 
the same SQL database.

Given this, is it a proper fit for akka persistence? I’m thinking I can do 
event sourcing. I will need to write a custom journal and snapshot plugin 
however since I want it to write to a SQL database with a predefined 
schema. The journal and snapshot plugins however are not generic — that is, 
they can only handle specific messages / state — in this case Deposit and 
Withdraw messages and balance as a state. Is this acceptable?


Jan Vincent Liwanag

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to