Exemplo n.º 1
0
 protected override void Context()
 {
     base.Context();
     StoreEvents.Advanced.CommitSingle();
     _observeCommits = PollingClient.ObserveFrom();
     _commitObserved = _observeCommits.FirstAsync().ToTask();
 }
Exemplo n.º 2
0
 protected override void Context()
 {
     base.Context();
     StoreEvents.Advanced.CommitSingle();
     _observeCommits     = PollingClient.ObserveFrom();
     _twoCommitsObserved = _observeCommits.Take(2).ToTask();
 }
Exemplo n.º 3
0
 protected override void Context()
 {
     base.Context();
     StoreEvents.Advanced.CommitSingle();
     _observeCommits1         = PollingClient.ObserveFrom();
     _observeCommits1Complete = _observeCommits1.Take(5).ToTask();
     _observeCommits2Complete = _observeCommits1.Take(10).ToTask();
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 protected override Task Context()
 {
     base.Context();
     StoreEvents.Advanced.CommitSingle();
     _observeCommits = PollingClient.ObserveFrom();
     _commitObserved = _observeCommits.FirstAsync().ToTask();
     return(Task.FromResult(true));
 }
Exemplo n.º 6
0
 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 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();
        }
Exemplo n.º 9
0
 protected override void Because()
 {
     PollingClient.Start();
     Task.Factory.StartNew(() =>
     {
         for (int i = 0; i < 15; i++)
         {
             StoreEvents.Advanced.CommitSingle();
         }
     });
 }
Exemplo n.º 10
0
        protected override async Task Context()
        {
            await base.Context();

            await StoreEvents.Advanced.CommitMany(4, null, "bucket_2");

            await StoreEvents.Advanced.CommitMany(4, null, "bucket_1");

            _observeCommits = PollingClient.ObserveFromBucket("bucket_1");
            _commitObserved = _observeCommits.FirstAsync().ToTask();
        }
 protected override Task Because()
 {
     PollingClient.Start();
     return(Task.Run(
                async() =>
     {
         for (int i = 0; i < 15; i++)
         {
             await StoreEvents.Advanced.CommitSingleAsync();
         }
     }));
 }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
        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);
                }
            }
        }
Exemplo n.º 16
0
 protected override void Because()
 {
     PollingClient.Start();
     StoreEvents.Advanced.CommitSingle();
 }
Exemplo n.º 17
0
 protected override Task Context()
 {
     _storeEvents   = Wireup.Init().UsingInMemoryPersistence().Build();
     _pollingClient = new PollingClient(_storeEvents.Advanced, PollingInterval);
     return(Task.FromResult(true));
 }
Exemplo n.º 18
0
 protected override void Cleanup()
 {
     PollingClient.Dispose();
 }
Exemplo n.º 19
0
 protected override void Because()
 {
     PollingClient.Start();
 }
 protected override Task Because()
 {
     PollingClient.Start();
     return(StoreEvents.Advanced.CommitSingleAsync());
 }
Exemplo n.º 21
0
 protected override void Because()
 {
     PollingClient.StartFromBucket("bucket_1");
 }
 protected override Task Because()
 {
     PollingClient.StartFromBucket("bucket_1");
     return(Task.CompletedTask);
 }
 protected override Task Because()
 {
     PollingClient.Start();
     return(Task.CompletedTask);
 }
 protected override Task Cleanup()
 {
     PollingClient.Dispose();
     return(Task.CompletedTask);
 }
Exemplo n.º 25
0
 protected override void Context()
 {
     _storeEvents = Wireup.Init().UsingInMemoryPersistence().Build();
     _pollingClient = new PollingClient(_storeEvents.Advanced, PollingInterval);
 }
Exemplo n.º 26
0
 protected override void Context()
 {
     _storeEvents   = Wireup.Init().UsingInMemoryPersistence().Build();
     _pollingClient = new PollingClient(_storeEvents.Advanced, PollingInterval);
 }
        protected override Task Context()
        {
            _storeEvents = Wireup.Init().UsingInMemoryPersistence().Build();
            _pollingClient = new PollingClient(_storeEvents.Advanced, PollingInterval);
			return Task.FromResult(true);
        }
Exemplo n.º 28
0
 public EventStoreClient(PollingClient pollingClient)
 {
     _pollingClient = pollingClient;
 }