public void SendTimeSeriesChanges(TimeSeriesChange change)
        {
            if (IsDisposed)
            {
                return;
            }

            if (_watchAllTimeSeries > 0)
            {
                Send(change);
                return;
            }

            if (change.Name != null && _matchingTimeSeries.Contains(change.Name))
            {
                Send(change);
                return;
            }

            if (change.DocumentId != null && _matchingAllDocumentTimeSeries.Contains(change.DocumentId))
            {
                Send(change);
                return;
            }

            if (change.DocumentId != null && change.Name != null && _matchingDocumentTimeSeries.Count > 0)
            {
                var parameters = new DocumentIdAndNamePair(change.DocumentId, change.Name);
                if (_matchingDocumentTimeSeries.Contains(parameters))
                {
                    Send(change);
                    return;
                }
            }
        }
Example #2
0
        public void AddAfterCommitNotification(TimeSeriesChange change)
        {
            change.TriggeredByReplicationThread = IncomingReplicationHandler.IsIncomingReplication;

            if (_timeSeriesNotifications == null)
            {
                _timeSeriesNotifications = new List <TimeSeriesChange>();
            }
            _timeSeriesNotifications.Add(change);
        }
Example #3
0
        public void RaiseNotifications(TimeSeriesChange timeSeriesChange)
        {
            OnTimeSeriesChange?.Invoke(timeSeriesChange);

            foreach (var connection in Connections)
            {
                if (!connection.Value.IsDisposed)
                {
                    connection.Value.SendTimeSeriesChanges(timeSeriesChange);
                }
            }
        }
        private void Send(TimeSeriesChange change)
        {
            var value = new DynamicJsonValue
            {
                ["Type"]  = nameof(TimeSeriesChange),
                ["Value"] = change.ToJson()
            };

            if (_disposeToken.IsCancellationRequested == false)
            {
                _sendQueue.Enqueue(new ChangeValue
                {
                    ValueToSend = value,
                    AllowSkip   = true
                });
            }
        }