Hi,
I just created a
pull
request that adds live read models (as discussed in
this
thread) to akka-persistence. Live read models can be
implemented by extending the
Replicator
trait (and implementing Actor.receive, see also this
example
and
tests).
A replicator is a read-only processor that automatically receives
persistent messages that are written by a corresponding processor.
It can construct any replicator-specific state from the replicated
message stream and even create replicator-specific snapshots. You
can think of replicators as the R in CQRS.
Replicators do not directly interact with their corresponding
processor, they are updated by running incremental message replays
via the journal. Hence, you can start/use replicators also if the
corresponding processor is not running. If that processor is started
later, asociated replicators are updated automatically. A replicator
runs incremental replays periodically based on a configurable
interval but applications may also trigger incremental replays at
any time.
Replicators can also be used in combination with channels (see
example),
in the same way as Processor and EventsourcedProcessor.
The previous Processor implementation is now splitted into traits
Recovery,
Snapshotter
and Processor, so that common code can now be shared by Replicator
and Processor. The pull request still misses the Java API and user
docs. I'll add them later.
Please let me know what you think, would be great to have
replicators in 2.3.0.
Cheers,
Martin
--
Martin Krasser
blog: http://krasserm.blogspot.com
code: http://github.com/krasserm
twitter: http://twitter.com/mrt1nz