Event Message Name Changed

This commit is contained in:
geek 2017-05-11 17:02:44 +09:00
parent b9730776ab
commit 57646371c0
2 changed files with 7 additions and 7 deletions

View File

@ -157,7 +157,7 @@ func (c *configManager) addConfig() {
c.configs[m.Id] = &m c.configs[m.Id] = &m
// notify id // notify id
err = observer.Notify(messages.ADD_SENSOR_1, m.Id) err = observer.Notify(messages.SCF_SENSOR_ADD_DONE, m.Id)
if err != nil { if err != nil {
continue continue
} }
@ -186,7 +186,7 @@ func (c *configManager) removeConfig() {
delete(c.configs, removeid) delete(c.configs, removeid)
// notify id // notify id
err = observer.Notify(messages.REMOVE_SENSOR_1, removeid) err = observer.Notify("TASK_DONE", removeid)
if err != nil { if err != nil {
continue continue
} }

View File

@ -20,7 +20,7 @@ func agentStartHandler() {
} }
observer.Remove(messages.AGENT_STARTED, agentStart) 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() { go func() {
_ = <-agentEnd _ = <-agentEnd
observer.Remove(messages.AGENT_WILL_STOPPED, agentEnd) observer.Remove(messages.AGENT_WILL_STOPPED, agentEnd)
observer.Remove(messages.ADD_SENSOR_0,_configManager.addCh) observer.Remove(messages.TASK_SENSOR_ADD,_configManager.addCh)
observer.Remove(messages.REMOVE_SENSOR_0,_configManager.removeCh) observer.Remove(messages.TASK_SENSOR_REMOVE,_configManager.removeCh)
}() }()
} }
func addSensorHandler() { func addSensorHandler() {
observer.Add(messages.ADD_SENSOR_0,_configManager.addCh) observer.Add(messages.TASK_SENSOR_ADD,_configManager.addCh)
go _configManager.addConfig() go _configManager.addConfig()
} }
func removeSensorHandler() { func removeSensorHandler() {
observer.Add(messages.REMOVE_SENSOR_0,_configManager.removeCh) observer.Add(messages.TASK_SENSOR_REMOVE,_configManager.removeCh)
go _configManager.removeConfig() go _configManager.removeConfig()
} }