Added : Subscription API similar to read API i.e. iteration based rather than callback based
Added : With new API, user code can now receive control messages like Checkpoint, CaughtUp (this new control message will be part of a separate PR and is the actual goal of DB-224) etc. from the subscription in addition to events
Example :
var subscription = client.SubscribeToAll(FromAll.Start);
await foreach (var message in subscription.Messages) {
if (message is StreamMessage.Event eventMessage) {
await eventAppeared(eventMessage.ResolvedEvent);
} else if (message is StreamMessage.SubscriptionMessage.Checkpoint checkpointMessage) {
await checkpointReached(checkpointMessage.Position);
}
}
subscriptionDropped();
Added : Subscription API similar to read API i.e. iteration based rather than callback based Added : With new API, user code can now receive control messages like
Checkpoint
,CaughtUp
(this new control message will be part of a separate PR and is the actual goal of DB-224) etc. from the subscription in addition to eventsExample :