/// <summary>Constructs state for EventStoreCatchUpSubscription.</summary> /// <param name="connection">The connection.</param> /// <param name="log">The <see cref="T:ReactiveDomain.ILogger" /> to use.</param> /// <param name="streamId">The stream name.</param> /// <param name="userCredentials">User credentials for the operations.</param> /// <param name="eventAppeared">Action invoked when events are received.</param> /// <param name="liveProcessingStarted">Action invoked when the read phase finishes.</param> /// <param name="subscriptionDropped">Action invoked if the subscription drops.</param> /// <param name="settings">Settings for this subscription.</param> protected CatchUpSubscription( IStreamStoreConnection connection, ILogger log, string streamId, UserCredentials userCredentials, Func <CatchUpSubscription, RecordedEvent, Task> eventAppeared, Action <CatchUpSubscription> liveProcessingStarted, Action <CatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped, CatchUpSubscriptionSettings settings) { Ensure.NotNull(connection, nameof(connection)); Ensure.NotNull(log, nameof(log)); Ensure.NotNull(eventAppeared, nameof(eventAppeared)); _connection = connection; Log = log; StreamId = string.IsNullOrEmpty(streamId) ? string.Empty : streamId; _userCredentials = userCredentials; ReadBatchSize = settings.ReadBatchSize; MaxPushQueueSize = settings.MaxLiveQueueSize; EventAppeared = eventAppeared; _liveProcessingStarted = liveProcessingStarted; _subscriptionDropped = subscriptionDropped; Verbose = settings.VerboseLogging; SubscriptionName = settings.SubscriptionName ?? string.Empty; }
internal StreamCatchUpSubscription(IStreamStoreConnection connection, ILogger log, string streamId, long?fromEventNumberExclusive, UserCredentials userCredentials, Func <CatchUpSubscription, RecordedEvent, Task> eventAppeared, Action <CatchUpSubscription> liveProcessingStarted, Action <CatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped, CatchUpSubscriptionSettings settings) : base(connection, log, streamId, userCredentials, eventAppeared, liveProcessingStarted, subscriptionDropped, settings) { Ensure.NotNullOrEmpty(streamId, nameof(streamId)); long?nullable = fromEventNumberExclusive; _lastProcessedEventNumber = nullable ?? -1L; nullable = fromEventNumberExclusive; _nextReadEventNumber = nullable ?? 0L; }