Beispiel #1
0
        public Task <EventStoreSubscription> SubscribeToStreamAsync(
            string stream,
            bool resolveLinkTos,
            Func <EventStoreSubscription, ResolvedEvent, Task> eventAppeared,
            Action <EventStoreSubscription, SubscriptionDropReason, Exception> subscriptionDropped = null,
            UserCredentials userCredentials = null)
        {
            Ensure.NotNullOrEmpty(stream, "stream");
            Ensure.NotNull(eventAppeared, "eventAppeared");

            var source = new TaskCompletionSource <EventStoreSubscription>(TaskCreationOptions.RunContinuationsAsynchronously);

            Guid corrId = Guid.NewGuid();

            _subscriptions.StartSubscription(corrId, source, stream, GetUserCredentials(_settings, userCredentials), resolveLinkTos, eventAppeared, subscriptionDropped);

            return(source.Task);
        }