How do I get the position of current event received in subscription?

I am subscribing to all streams using below statement:

Connection.SubscribeToAllFrom(null, false, EventAppeared, SubscriptionDropped)

When my subscription client goes offline for some reason, I want to subscribe to streams from last received event.

However, when ‘EventAppeared’ method is called I see that @event.OriginalPosition is always null.

How do I keep track of last event position applied?

I am using EventStore 1.0.1 and EventStore.Client 1.10

Thanks in advance.

For subscribe all you track using the dual positions of commit and prepare. If you prefer take a look at dev branch… It’s about to be moved to master and has a durable subscription included in the client API which would avoid you having to write this code.

Sorry I dont have access to a machine right now but both James and I have gists of dispatchers that should lead you in the right direction. My github is pdoh00. James’s is prob jen20. Andrii may have a gist too

Thank you for the quick response. I will take a look at the suggested options.

The method of tracking position for a subscription to all is, as Greg says, via a pair of numbers which represent Commit and Prepare positions. This is different to subscribing to an individual stream where the sequence number suffices.

Take a look at this gist for how to do what you describe: