Building read model with projections

Hello,

i’m evaluating your Event Store system for our press release system written in PHP. So i’m fairly new to eventstore.

I managed to write a simple client for the http api to read and write on the events db using curl.

I wrote a lot of events on the stream and now i was wondering how i can get the projection of my aggregates back

to write them into my read model in redis or maybe mysql (legacy purpose).

For example consider the following event stream (in the real system there are much more of course):

ReleaseHasBeenDrafted -> Creates a release draft and hold initialized data (title, created time etc)

DispatchHasBeenScheduled -> Changes the scheduled dispatch date

TaskHasBeenAdded -> Adds a task and holds task data

TaskHasBeenFinished -> Change task status to finished

ReleaseHasBeenFinished -> Change status to finished when all tasks has been finished

How can replay the events of all streams and rebuild my full read model?

Can you give me a short example of how to use the projection api on my event stream to build my redis read model?

To read all events over http try /streams/$all it’s an atomfeed with all events. You may want ?embed=content. The lower level Apis jvm/.net/erlang/etc support this better but it’s possible over atom.

Cheers,

Greg

Reading through again you probably don’t want to use projections for this (you can but probably shouldn’t) instead read the atom feed mentioned and projection yourself

Thanks! Replaying the events by traversing the atom feed works great.

Can you somehow increase the amount of events per page?

That could be a setting but you probably don’t want to :slight_smile: