I am quite familiar with how the PersistentActor and PersistentView work while implementing Akka Persistence.
Consider the following example with the idea as far as I understand.
A Scala case class Contact.
case class Contact(id: String, version: Int, fName: String, lName: String, age: Int)
The PersistentActor persisted events in the journal are :
ContactCreated("123af-232ff-232d", 1, "john", "doe", 25)
FirstNameChanged("123af-232ff-232d", 2, "jan")
AgeChanged("123af-232ff-232d", 3, 27)
FirstNameChanged("123af-232ff-232d", 4, "janet")
Every time the commands are sent from the responsive UI, such new events are persisted if validation succeeds 202 CommandAccepted or any CommandValidationError being fired back.
But without significant delay in the responsive environment, the UI must be able to query the REST API backend and show the latest Contact object after the backend WebSocket push informs the UI that UUID "123af-232ff-232d" is available for read:
Contact("123af-232ff-232d", 4, "janet", "doe", 27)
This result should happen after merging all the events with the latest data available as I understand.
So, my actual concern is: How and where in this backend application I do the processing of those events as soon as they are generated, merge those data, and store the merged data for reading by the query side.
Many many thanks in advance if some could shed light on implementing or correcting my thought.