예제 #1
0
        public void StartListeningTo(string topicName, string recordKey, string fieldName, int topicId)
        {
            // Ensure we only listen to the topic once - this allows clients to call
            // us multiple times
            lock (lockObject)
            {
                // Add the recordKey/fieldName to topicId mapping and start subscribing
                var topicFieldKey = new TopicKey(recordKey, fieldName);

                if (!topicNameToTopicID.Contains(topicFieldKey))
                {
                    topicNameToTopicID.Add(topicFieldKey, topicId);
                    topicIDToTopicName.Add(topicId, topicFieldKey);
                }

                if (listeningToTopics.Contains(topicName))
                {
                    return;
                }

                if (CreateTopicListener(topicName))
                {
                    listeningToTopics.Add(topicName);
                }
            }
        }
예제 #2
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        public void RemoveTopic(int topicID)
        {
            if (topicIDToTopicName.Contains(topicID))
            {
                TopicKey topicFieldKey = (TopicKey)topicIDToTopicName[topicID];

                topicNameToTopicID.Remove(topicFieldKey);
                topicIDToTopicName.Remove(topicID);
            }
        }
예제 #3
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        private void RegisterGenericChange(string fieldName, string fieldValue)
        {
            var topicFieldKey = new TopicKey(fieldName, fieldName);

            if (_topicNameToTopicId.Contains(topicFieldKey))
            {
                var topicId = (int)_topicNameToTopicId[topicFieldKey];
                // remove incase it is already present
                UpdateChangedTopic(topicId, fieldValue);
            }
        }
예제 #4
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        private void RegisterGenericChange(string fieldName, string fieldValue)
        {
            TopicKey topicFieldKey = new TopicKey(fieldName, fieldName);

            if (topicNameToTopicID.Contains(topicFieldKey))
            {
                int topicID = (int)topicNameToTopicID[topicFieldKey];
                // remove incase it is already present
                changedTopics.Remove(topicID);
                changedTopics.Add(topicID, fieldValue);
            }
        }
예제 #5
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        private void AddAdminFieldUpdates(string topicKey, IDictionary parsedMessage)
        {
            var accountPair = "account=" + parsedMessage["account"];

            foreach (var fieldName in _accountAdminFields)
            {
                var recordKey = BuildPositionLookupKey(accountPair, fieldName);

                var topicFieldKey = new TopicKey(recordKey, fieldName);

                if (_topicNameToTopicId.Contains(topicFieldKey))
                {
                    var topicId = (int)_topicNameToTopicId[topicFieldKey];
                    // remove incase it is already present
                    UpdateChangedTopic(topicId, LookupValue(topicKey, fieldName));
                }
            }
        }
예제 #6
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        private void AddAdminFieldUpdates(string topicKey, IDictionary parsedMessage)
        {
            string accountPair = "account=" + parsedMessage["account"];

            foreach (string fieldName in AccountAdminFields)
            {
                string recordKey = BuildPositionLookupKey(accountPair, fieldName);

                TopicKey topicFieldKey = new TopicKey(recordKey, fieldName);

                if (topicNameToTopicID.Contains(topicFieldKey))
                {
                    int topicID = (int)topicNameToTopicID[topicFieldKey];
                    // remove incase it is already present
                    changedTopics.Remove(topicID);
                    changedTopics.Add(topicID, lookupValue(topicKey, fieldName));
                }
            }
        }
예제 #7
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        private void RegisterChange(string topicKey, IDictionary parsedMessage)
        {
            // for each topic and record, add them to the list of changed topics
            lock (_lockObject)
            {
                foreach (string fieldName in parsedMessage.Keys)
                {
                    var topicFieldKey = new TopicKey(topicKey, fieldName);

                    if (_topicNameToTopicId.Contains(topicFieldKey))
                    {
                        var topicId = (int)_topicNameToTopicId[topicFieldKey];
                        // remove incase it is already present
                        UpdateChangedTopic(topicId, (string)parsedMessage[fieldName]);
                    }
                }
            }
            // add in the admin fields
            AddAdminFieldUpdates(topicKey, parsedMessage);
        }
예제 #8
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        private void RegisterChange(string topicKey, IDictionary parsedMessage)
        {
            // for each topic and record, add them to the list of changed topics
            lock (lockObject)
            {
                foreach (string fieldName in parsedMessage.Keys)
                {
                    TopicKey topicFieldKey = new TopicKey(topicKey, fieldName);

                    if (topicNameToTopicID.Contains(topicFieldKey))
                    {
                        int topicID = (int)topicNameToTopicID[topicFieldKey];
                        // remove incase it is already present
                        changedTopics.Remove(topicID);
                        changedTopics.Add(topicID, parsedMessage[fieldName]);
                    }
                }
            }
            // add in the admin fields
            AddAdminFieldUpdates(topicKey, parsedMessage);
        }
예제 #9
0
파일: NmsClient.cs 프로젝트: TzarIvan/ratel
        public override bool Equals(Object other)
        {
            TopicKey otherKey = other as TopicKey;

            return(topicName == otherKey.topicName && fieldName == otherKey.fieldName);
        }