StreamPosition Start

Hello Guys

I have the following lines. The problem is that the first event from the stream is ignored. checkpointValue can be null. I thought StreamPosition.Start would have done the job. I am using .net grpc client

 var checkpointValue = await GetCheckpoint(_streamName);

 var streamPosition = checkpointValue.HasValue ? StreamPosition.FromInt64(checkpointValue.GetValueOrDefault()) : StreamPosition.Start;

Maybe this will help:

@steven.blair

Thanks. I came across that blog post but I think it is an old one That uses a different nupkg.

I am using
EventStore.Client.Grpc.Streams

@alexey.zimarev any ideas

What exactly are you doing, reading or subscribing? Reads should work fine.

I am subscribing to a catch up subscription. So start reading I try to get the existing position. If there is no existing position then I use StreamPosition.Start;

I guess you aren’t subscribing to all, are you?

I am subscribing because the 2 event does appear in the Stream… Just the first one does not appear

Ok, reformulating:

Are you subscribing to $all stream or to a normal stream, or to a projection stream?

I am subscribing to a projection… $ce-Customers

If you have no checkpoint (i.e. when you are starting out) use the overload that doesn’t take a StreamPosition. e.g.,

var subscription = !checkpoint.HasValue 
  ? await client.SubscribeToStream(_streamName, EventAppeared)
  : await client.SubscribeToStream(_streamName, new StreamPosition((ulong)checkpoint.Value), EventAppeared);
1 Like

Reference: https://github.com/Eventuous/eventuous/blob/master/src/Eventuous.EventStoreDB.Subscriptions/StreamSubscriptionService.cs#L39

1 Like