Esempio n. 1
0
func (this *Collied) SheepAdd(conf *process.Config) error {
	conf.Expand(this.conf.ProcessModel)

	var sheep = process.NewSheep()
	var err = sheep.Create(conf)
	if err != nil {
		return err
	}

	this.sheeps[sheep.Name] = sheep
	return nil
}
Esempio n. 2
0
func (this *Collied) LoadConfig(conf *ContexConfig) (err error) {
	conf.Expand()
	for name, processConf := range conf.Process {
		sheep := process.NewSheep()
		if err = sheep.Create(processConf); err != nil {
			log.Errorf("load sheep : %+v --- %s", name, err.Error())
			return
		}
		// log.Logf("load sheep : %+v", processConf)
		this.sheeps[name] = sheep
	}
	this.conf.ProcessModel = conf.ProcessModel
	this.conf.ConfigPath = conf.ConfigPath
	return
}