From 57646371c02e203b01aa644ce330ae206a500a04 Mon Sep 17 00:00:00 2001 From: geek Date: Thu, 11 May 2017 17:02:44 +0900 Subject: [PATCH] Event Message Name Changed --- config_manager.go | 4 ++-- init_method.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config_manager.go b/config_manager.go index 847eb77..82c812a 100644 --- a/config_manager.go +++ b/config_manager.go @@ -157,7 +157,7 @@ func (c *configManager) addConfig() { c.configs[m.Id] = &m // notify id - err = observer.Notify(messages.ADD_SENSOR_1, m.Id) + err = observer.Notify(messages.SCF_SENSOR_ADD_DONE, m.Id) if err != nil { continue } @@ -186,7 +186,7 @@ func (c *configManager) removeConfig() { delete(c.configs, removeid) // notify id - err = observer.Notify(messages.REMOVE_SENSOR_1, removeid) + err = observer.Notify("TASK_DONE", removeid) if err != nil { continue } diff --git a/init_method.go b/init_method.go index 9fb8756..5b0e8d7 100644 --- a/init_method.go +++ b/init_method.go @@ -20,7 +20,7 @@ func agentStartHandler() { } observer.Remove(messages.AGENT_STARTED, agentStart) - observer.Notify(messages.CONFIGMANAGER_LOADED, _configManager) + observer.Notify(messages.CFG_LOADED, _configManager) }() } @@ -30,18 +30,18 @@ func agentEndHandler() { go func() { _ = <-agentEnd observer.Remove(messages.AGENT_WILL_STOPPED, agentEnd) - observer.Remove(messages.ADD_SENSOR_0,_configManager.addCh) - observer.Remove(messages.REMOVE_SENSOR_0,_configManager.removeCh) + observer.Remove(messages.TASK_SENSOR_ADD,_configManager.addCh) + observer.Remove(messages.TASK_SENSOR_REMOVE,_configManager.removeCh) }() } func addSensorHandler() { - observer.Add(messages.ADD_SENSOR_0,_configManager.addCh) + observer.Add(messages.TASK_SENSOR_ADD,_configManager.addCh) go _configManager.addConfig() } func removeSensorHandler() { - observer.Add(messages.REMOVE_SENSOR_0,_configManager.removeCh) + observer.Add(messages.TASK_SENSOR_REMOVE,_configManager.removeCh) go _configManager.removeConfig() }