Getting Started Akka Persistence Projections


I am working on app built on event sourcing/cqrs/ddd approach. For querying/searching/reporting, found out Projections are the right fit.

I searched from any examples over github. Did not find any.

It would be very helpful. Let me know from where to start.

Any links and suggestions are welcome.

-Prakhyat M M


This depends on exactly what you mean by “projection” - do you mean the generic term (e.g. to service queries such as “customers whose first name begins with “R”) or specifically projections within the Event Store which are most suited for temporal correlation
querying, indexing etc?


Hi James,

I meant service queries such as “customers whose first name begins with “R” but using eventstore.

If you don’t mind can you let me know What do you mean by temporal correlation querying?

-prakhyat m m

So there is in the client a CatchUpSubscription this basically allows you to use your event store as a queue (including for all messages hitting it). This will forward all the events to a handler of your choice. You would then in that handler update a database etc of your choosing. eg when you receive “OrderPlaced” you would insert into table … You can then query that persistent store directly



See here btw:,d.cGU

Hi Greg,

Thanks again.

Can you help me with code sample in GitHub or net. I will go through the code in detail. Below text gave me a hint on projection ,To be frank Below is very short note I want to understand projections in detail.

There are no examples available in this regard. I want to use projections for business related querying/reporting.

-prakhyat m m

See CountAllEvents more in the repo. You would just be inserting/updating your store of choice instead of counting in a variable




Thanks I will look into code.

I was following your comments from post “improving performance of akka persistence”. In this post also you mentioned about eventstore.jvm. Did not feel that is write post to ask below question.

What is eventstore.jvm?what is the purpose of this project?

-prakhyat m n

It is the officially supported event store jvm client (it talks over the protobuf over tcp protocol). It is currently written in scala/akka and has java wrappers for java developers.



Also the akka.persistence adapter uses the client to talk to the event store.


Thanks again.

Does this project have any example showing querying with complex joins?

What you would do is setup a subscription just like in the example, in that actor/java code you would then write into whatever model you wanted (say sql or hadoop or a graphdb) then you would query whatever data storage you put it into. Obviously we don’t include how to query with joins in SQL as it has nothing to do with us and there is plenty of documentation for whichever database you happen to choose to use for such querying.

Hi Greg,

I looked at I was not able to figure out How to use it to integrate with akka persistence event store.

Let me give you some clarity on what I want to achieve.

My app is based upon approach event sourced/cqrs/DDD.

My app uses Akka Persistence with cassandra event store.

Consider I have domain model’s,



Bank object will have many customers.

Every customer will have multiple accounts.

Consider for sake of discussion I have made each Domain object as Aggregate Root using API PesistentActor. Each AR is a single writer.

Consider app is designed to receive below events,

  1. createBank

  2. addCustomer

  3. createAccount

  4. creditAccount

  5. debitAccount

Consider system receives events,

  1. createBank —> to create “BankAkka”. Bank AR will receive this event.

  2. addCustomer --> to include customer “Meee”. Customer AR will receive this event.

  3. createAccount -->create savings account. Account AR will receive this event.

  4. creditAccount–>200$. Account AR will receive this event.

  5. debitAccount -->150$. Account AR will receive this event.

Each AR after receiving event will save event to event store and later handled by handler.

I want to implement a query : Give all customers in system whose balance is less then 100$.

How to integrate EventStore.JVM with event store of akka persistence. In my event store is cassandra.

-Prakhyat M M

There is a separate project to use event store with Akka.peristence on that github account the jvm project is the client. That said using event store with Akka.persistence is an either or decision with Cassandra


There is a separate project to use event store with Akka.peristence on that github account the jvm project is the client.

[Prakhyat] can you share the project. Also will it have example for using projection?

That said using event store with Akka.persistence is an either or decision with Cassandra.

[Prakhyat] I did not understand what you meant.

You mention you use Cassandra as your Akka.persistence store. Event store is it’s own db and that is the driver for Akka.persistence with it (depends on eventstore.jvm which is the client)