user1685095
user1685095

Reputation: 6121

How to view and query event journal in scala akka persistence?

I don't have any code to show just yet, because it just not ready, but from what I've read about scala akka persistence it's not clear to me how to get all events in aggregate and expose them in json through http.

Upvotes: 1

Views: 824

Answers (1)

johanandren
johanandren

Reputation: 11479

In Akka 2.3 PersistentViews is meant for the Q side of CQRS (querying or "read side"), they allow for an actor to follow the domain events written by the PersistentActor (which is the C side - commands or "write side").

This changes quite a bit in Akka 2.4 which is soon to be released where PersistentView is replaced by Persistent Query which has a Akka Streams API instead of the requirement of being an actor.

It is often a good idea to have a specialized data store for the query side, which allows for a persistence solution that fits the type of querying and whatever aggregation you would want. To make that available over HTTP as JSON would be outside the scope of Akka Persistence, but can easily be done using Play Framework or Akka HTTP (the latter might not be performant enough for production yet, depending on your needs).

Hope this helps.

Upvotes: 5

Related Questions