protected override void Context() { base.Context(); StoreEvents.Advanced.CommitSingle(); _observeCommits = PollingClient.ObserveFrom(); _twoCommitsObserved = _observeCommits.Take(2).ToTask(); }
protected override void Context() { base.Context(); StoreEvents.Advanced.CommitSingle(); _observeCommits = PollingClient.ObserveFrom(); _commitObserved = _observeCommits.FirstAsync().ToTask(); }
protected override void Context() { base.Context(); StoreEvents.Advanced.CommitMany(4, null, "bucket_2"); StoreEvents.Advanced.CommitMany(4, null, "bucket_1"); _observeCommits = PollingClient.ObserveFrom(); _commitObserved = _observeCommits.FirstAsync().ToTask(); }
protected override void Context() { base.Context(); StoreEvents.Advanced.CommitSingle(); _observeCommits = PollingClient.ObserveFrom(); _subscriberException = new Exception(); _subscription = _observeCommits.Subscribe(c => { throw _subscriberException; }, ex => _onErrorException = ex); }
protected override void Context() { base.Context(); StoreEvents.Advanced.CommitSingle(); _observeCommits1 = PollingClient.ObserveFrom(); _observeCommits1Complete = _observeCommits1.Take(5).ToTask(); _observeCommits2Complete = _observeCommits1.Take(10).ToTask(); }
protected override Task Context() { base.Context(); StoreEvents.Advanced.CommitSingle(); _observeCommits = PollingClient.ObserveFrom(); _commitObserved = _observeCommits.FirstAsync().ToTask(); return(Task.FromResult(true)); }
protected override async Task Context() { await base.Context(); await StoreEvents.Advanced.CommitSingleAsync(); _observeCommits = PollingClient.ObserveFrom(); _twoCommitsObserved = _observeCommits.Take(2).ToTask(); }
protected override async Task Context() { await base.Context(); await StoreEvents.Advanced.CommitSingleAsync(); _observeCommits1 = PollingClient.ObserveFrom(); _observeCommits1Complete = _observeCommits1.Take(5).ToTask(); _observeCommits2Complete = _observeCommits1.Take(10).ToTask(); }
public void Start() { var start = _tracker.LoadCheckpoint(); var client = new PollingClient(_eventStore.Advanced, 1000); var dispatcher = new CommitsDispatcher(_tracker, Logger); _observer = client.ObserveFrom(start); _subscription = _observer.Subscribe(dispatcher); _observer.Start(); Logger.InfoFormat("Projection engine started from {0}", start); }
protected override void Context() { base.Context(); StoreEvents.Advanced.CommitSingle(); _observeCommits = PollingClient.ObserveFrom(); _commitObserved = _observeCommits.FirstAsync().ToTask(); _observeCommits.Start(); _commitObserved.Wait(PollingInterval * 2); _observeCommits.Dispose(); StoreEvents.Advanced.CommitSingle(); string checkpointToken = _commitObserved.Result.CheckpointToken; _observeCommits = PollingClient.ObserveFrom(checkpointToken); }
protected override async Task Context() { await base.Context(); await StoreEvents.Advanced.CommitSingle(); _observeCommits = PollingClient.ObserveFrom(); _commitObserved = _observeCommits.FirstAsync().ToTask(); await _observeCommits.Start(); var task = await Task.WhenAny(_commitObserved, Task.Delay(PollingInterval * 2)); task.Should().Be(_commitObserved); _observeCommits.Dispose(); await StoreEvents.Advanced.CommitSingle(); string checkpointToken = _commitObserved.Result.CheckpointToken; _observeCommits = PollingClient.ObserveFrom(checkpointToken); }
private static void Main() { using (var store = WireupEventStore()) { var client = new PollingClient(store.Advanced); string checkpointToken = LoadCheckpoint(); using (IObserveCommits observeCommits = client.ObserveFrom(checkpointToken)) using (observeCommits.Subscribe(commit => { // Project the commit etc Console.WriteLine(Resources.CommitInfo, commit.BucketId, commit.StreamId, commit.CommitSequence); // Track the most recent checkpoint checkpointToken = commit.CheckpointToken; })) { observeCommits.Start(); Console.WriteLine(Resources.PressAnyKey); Console.ReadKey(); SaveCheckpoint(checkpointToken); } } }