Reading Projections using the Client API

EventStore Version: 3.0.1 (OSS)

API Type: .NET API (using EventStore.ClientAPI)

Platform: Windows

I have been having a difficult time figuring out how to read or subscribe to a projection using the Client API. Does it only work with subscriptions? I tried:

connection.ReadStreamEventsForwardAsync("$all", …

But this returns SliceReadStatus.StreamNotFound. I am connecting as Admin. Are projections intended to be used only with subscriptions? The documentation is not clear about that. I didn’t have time to try the subscribe functions last night. I should have time this evening to give it a spin.

To create a ‘shovel’ type application, I assume I would use something along the following:

connection.SubscribeToStreamFrom("$all", …

In this example, I am using $all, but it could be a system projection like “by category” or “by event type”. I may want to get by event type for example to trigger when a customer is created. Subscriptions make sense to me.

To read all events use the readalleventsforward method.

To read from a stream like $myeventtype use readstreamforward as you are

Btw for the case of building something that moves events you probably just want to use a catchupsubscription which handles live pushes vs historical reads for you see:

https://github.com/EventStore/EventStore/blob/dev/src/EventStore.ClientAPI/IEventStoreConnection.cs#L247 for stream

https://github.com/EventStore/EventStore/blob/dev/src/EventStore.ClientAPI/IEventStoreConnection.cs#L356 for all

It allows you to just remember the last event you read and pass it back. It will handle all of the coordination for you as opposed to use read forward which will put you into a polling mechanism.

Greg