All the docs I can find seem to suggest I need two http requests to do this: one to the stream, giving me a link to the last event, and then one to follow that link.
That seems bizarre, isn't there a way to do this with just one request?
If using the .NET Client you can also use the read backwards API
Task<StreamEventsSlice> ReadStreamEventsBackwardAsync(string stream, int start, int count, bool resolveLinkTos)
Where
StreamPosition.End
(-1) to start from the end.So this code will get you the last event on the stream (with linkTos enabled if its a projection)
StreamEventsSlice slice = await Connection.ReadStreamEventsBackwardAsync("StreamName", StreamPosition.End, 1, true, creds);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With