public IDisposable SubscribeToAllFrom(Position @from, Action <RecordedEvent> eventAppeared, CatchUpSubscriptionSettings settings = null, Action liveProcessingStarted = null, Action <SubscriptionDropReason, Exception> subscriptionDropped = null, UserCredentials userCredentials = null, bool resolveLinkTos = true) { var current = (int)@from.CommitPosition; var currentEvents = new RecordedEvent[] { }; lock (_allStream) { if (@from == Position.End) { current = _allStream.Count - 1; } if (current < _allStream.Count - 1) { var events = new RecordedEvent[_allStream.Count - current]; _allStream.CopyTo(events, current); currentEvents = events; } } for (int i = 0; i < currentEvents.Length; i++) { eventAppeared(currentEvents[i]); } var subscription = new AllStreamSubscription(current, subscriptionDropped, eventAppeared); subscription.BusSubscription = _inboundEventBus.Subscribe(subscription); _subscriptions.Add(subscription); liveProcessingStarted?.Invoke(); return(subscription); }
protected override async Task <IAllStreamSubscription> SubscribeToAllInternal( long?fromPosition, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, string name, CancellationToken cancellationToken) { var subscription = new AllStreamSubscription( fromPosition, this, GetStoreObservable, streamMessageReceived, subscriptionDropped, name); await subscription.Start(cancellationToken); return(subscription); }
protected override async Task <IAllStreamSubscription> SubscribeToAllInternal( long?fromCheckpoint, StreamEventReceived streamEventReceived, SubscriptionDropped subscriptionDropped, string name, CancellationToken cancellationToken) { var subscription = new AllStreamSubscription( fromCheckpoint, this, _subscriptions, streamEventReceived, subscriptionDropped, name); await subscription.Start(cancellationToken); return(subscription); }
public EventStoreHostedService(IEventStoreConnection connection, AllStreamSubscription subscription) { _connection = connection; _subscription = subscription; }