private void topicDetailsHandler_Success(object sender, Handlers.TopicDetailsEventArgs e) { Log.Spew("Queried Topic: \"" + e.TopicPath + "\""); if (!rootTopicPath.Equals(e.TopicPath)) { throw new InvalidOperationException("Topic details received for unexpected topic path."); } if (null == e.TopicDetails) { // The root topic path does not yet exist so we need to create it implicitly // by creating the child nodes. Log.Spew("Creating topic tree..."); var addTopicHandler = new Handlers.AddTopicHandler(); addTopicHandler.Success += addTopicHandler_Success; AddTopic(addTopicHandler, steeringTopicPath); AddTopic(addTopicHandler, brakingTopicPath); AddTopic(addTopicHandler, accelerationTopicPath); AddTopic(addTopicHandler, gearTopicPath); AddTopic(addTopicHandler, refreshIntervalTopicPath, TopicType.RECORD); AddTopic(addTopicHandler, buttonStatesTopicPath, TopicType.RECORD); AddTopic(addTopicHandler, buttonNamesTopicPath, TopicType.RECORD); AddTopic(addTopicHandler, countOfUpdatesMetricTopicPath); AddTopic(addTopicHandler, upTimeInSecondsMetricTopicPath); AddTopic(addTopicHandler, countOfSuccessfulTopicSourceUpdatesMetricTopicPath); AddTopic(addTopicHandler, countOfFailedTopicSourceUpdatesMetricTopicPath); AddTopic(addTopicHandler, rateOfUpdatesPerSecondMetricTopicPath); AddTopic(addTopicHandler, rateOfSuccessfulTopicSourceUpdatesPerSecond); } else { // The root topic path exists so we need to start updating it. // (I am making the assumption that all of the topics I need to have added // below this root will be there... this could break if I add a new topic to the // tree in this codebase without restarting the Diffusion server or removing the // root topic first.) AddTopicSources(); } }
private void AddTopic(Handlers.AddTopicHandler handler, string path) { AddTopic(handler, path, TopicType.SINGLE_VALUE); }
private void AddTopic(Handlers.AddTopicHandler handler, string path, TopicType topicType) { topicPathsPendingAddition.Add(path); topicControl.AddTopic(path, topicType, handler); }
private void topicDetailsHandler_Success(object sender, Handlers.TopicDetailsEventArgs e) { Log.Spew("Queried Topic: \"" + e.TopicPath + "\""); if (!rootTopicPath.Equals(e.TopicPath)) throw new InvalidOperationException("Topic details received for unexpected topic path."); if (null == e.TopicDetails) { // The root topic path does not yet exist so we need to create it implicitly // by creating the child nodes. Log.Spew("Creating topic tree..."); var addTopicHandler = new Handlers.AddTopicHandler(); addTopicHandler.Success += addTopicHandler_Success; AddTopic(addTopicHandler, steeringTopicPath); AddTopic(addTopicHandler, brakingTopicPath); AddTopic(addTopicHandler, accelerationTopicPath); AddTopic(addTopicHandler, gearTopicPath); AddTopic(addTopicHandler, refreshIntervalTopicPath, TopicType.RECORD); AddTopic(addTopicHandler, buttonStatesTopicPath, TopicType.RECORD); AddTopic(addTopicHandler, buttonNamesTopicPath, TopicType.RECORD); AddTopic(addTopicHandler, countOfUpdatesMetricTopicPath); AddTopic(addTopicHandler, upTimeInSecondsMetricTopicPath); AddTopic(addTopicHandler, countOfSuccessfulTopicSourceUpdatesMetricTopicPath); AddTopic(addTopicHandler, countOfFailedTopicSourceUpdatesMetricTopicPath); AddTopic(addTopicHandler, rateOfUpdatesPerSecondMetricTopicPath); AddTopic(addTopicHandler, rateOfSuccessfulTopicSourceUpdatesPerSecond); } else { // The root topic path exists so we need to start updating it. // (I am making the assumption that all of the topics I need to have added // below this root will be there... this could break if I add a new topic to the // tree in this codebase without restarting the Diffusion server or removing the // root topic first.) AddTopicSources(); } }