EventStore / EventStore-Client-Dotnet

Dotnet Client SDK for the Event Store gRPC Client API written in C#
Other
147 stars 38 forks source link

Stream subscription returns links to deleted events when ResolveLinkTos is set to true #152

Open alexeyzimarev opened 3 years ago

alexeyzimarev commented 3 years ago

The ResolvedEvent.Event property is not nullable, so we assume that the property value is never null.

However, a catch-up subscription to a projected stream (i.e. category stream) with links to deleted events in it, delivers events to the subscriber where Event is null.

Steps to reproduce:

I have a test in Eventuous, which reproduces the issue, so I can be sure that Eventuous can handle this properly.

Here is the test: https://github.com/Eventuous/eventuous/blob/26f3750da676b3ab85bb8e2f6be8934a2e045c04/test/Eventuous.Tests.EventStore/StreamSubscriptionTests.cs#L33

Here is the workaround: https://github.com/Eventuous/eventuous/blob/26f3750da676b3ab85bb8e2f6be8934a2e045c04/src/Eventuous.Subscriptions.EventStoreDB/StreamSubscription.cs#L114-L124

alexeyzimarev commented 3 years ago

I believe it can be handled in two ways:

Note that other clients might handle the case differently. For example, the NodeJS client has the event property marked as nullable.

Mousaka commented 2 years ago

I would opt for the first suggestion. It's very confusing to have a type named ResolvedEvent but you are not able to assume that it is actually Resolved. EDIT: Alternatively, change the name of the type to something that makes sense.