/// <remarks> /// This constructor is private so that it is obvious (via <c>StartNew</c>) /// that background tasks are being creatd. /// </remarks> private EventStreamService( StorageConfiguration storage, IEnumerable <IProjection <TEvent> > projections, IProjectionCacheProvider projectionCache, ILogAdapter log, CancellationToken cancel) : base(TimeSpan.FromSeconds(30), cancel) { _log = log; _cancel = cancel; Wrapper = new EventStreamWrapper <TEvent, TState>(storage, projections, projectionCache, log); Quarantine = Wrapper.Quarantine; Ready = Task.Run(Initialize, cancel); }
/// <remarks> /// This constructor is private so that it is obvious (via <c>StartNew</c>) /// that background tasks are being creatd. /// </remarks> private EventStreamService( StorageConfiguration storage, IEnumerable <IProjection <TEvent> > projections, IProjectionCacheProvider projectionCache, IEnumerable <Tuple <EventStream <TEvent> .Listener, uint> > events, ILogAdapter log, CancellationToken cancel) { _log = log; _cancel = cancel; Wrapper = new EventStreamWrapper <TEvent, TState>(storage, projections, projectionCache, log); Quarantine = Wrapper.Quarantine; if (events != null) { foreach (var pair in events) { Wrapper.OnEachCommitted(pair.Item1, pair.Item2); } } Ready = Task.Run(Initialize, cancel); Task.Run(Loop, cancel); }