Exemplo n.º 1
0
        public void Init()
        {
            //checkpoint token, can be persisted so we don't need to read the EventStore from scratch
            string checkpointToken = null;

            var pollingClient = new PollingClient(Program.StoreEvents.Advanced);

            _observer = pollingClient.ObserveFromBucket(InvoicesBucketId, checkpointToken);
            _observer.Subscribe(new InvoicesObserver());

            //init the projection on startup
            _observer.PollNow();

            //start a long running task that will poll the event store periodicaly
            _observerTask = _observer.Start();
        }