Exemple #1
0
        private void StartWatchingDocs()
        {
            changes.ConnectionStatusChanged += ChangesApiConnectionChanged;

            var allDocsObservable = changes.ForAllDocuments();

            putDocumentsObserver = allDocsObservable.Subscribe(notification =>
            {
                if (notification.Type == DocumentChangeTypes.Put && notification.Id.StartsWith("Raven/", StringComparison.OrdinalIgnoreCase) == false)
                {
                    newDocuments.Set();
                }
            });

            var bulkInsertObservable = changes.ForBulkInsert();

            endedBulkInsertsObserver = bulkInsertObservable.Subscribe(notification =>
            {
                if (notification.Type == DocumentChangeTypes.BulkInsertEnded)
                {
                    newDocuments.Set();
                }
            });

            Task.WaitAll(new Task[]
            {
                allDocsObservable.Task, bulkInsertObservable.Task
            });
        }
Exemple #2
0
        private void StartWatchingDocs()
        {
            changes.ConnectionStatusChanged += ChangesApiConnectionChanged;

            PutDocumentsObserver = changes.ForAllDocuments().Subscribe(notification =>
            {
                if (notification.Type == DocumentChangeTypes.Put && notification.Id.StartsWith("Raven/", StringComparison.OrdinalIgnoreCase) == false)
                {
                    newDocuments.Set();
                }
            });

            EndedBulkInsertsObserver = changes.ForBulkInsert().Subscribe(notification =>
            {
                if (notification.Type == DocumentChangeTypes.BulkInsertEnded)
                {
                    newDocuments.Set();
                }
            });
        }
 private void SubscribeToBulkInsertNotifications(IDatabaseChanges changes)
 {
     subscription = changes
                    .ForBulkInsert(OperationId)
                    .Subscribe(this);
 }