Exemple #1
0
func (self *evtproc) ExecuteEvent(ictx kernel.IEvtCtx) kernel.Error {
	ctx := ictx.Idx()
	self.MsgDebug("executing event [%v]... (#algs: %v)\n", ctx, len(self.algs))
	for i, alg := range self.algs {
		self.MsgDebug("-- ctx:%03v --> [%s]...\n", ctx, alg.CompName())
		if !alg.Execute(ictx).IsSuccess() {
			self.MsgError("pb executing alg #%v (%s) for ctx:%v\n",
				i, alg.CompName(), ictx.Idx())
			return kernel.StatusCode(1)
		}
	}
	self.MsgDebug("data: %v\n", ictx.Store())
	return kernel.StatusCode(0)
}
Exemple #2
0
func (self *datastoresvc) Store(ctx kernel.IEvtCtx) kernel.IDataStore {
	store := ctx.Store()
	n := self.CompName()
	if _, ok := store[n]; !ok {
		dstore := make(kernel.DataStore)
		//dstore := make(map[string]chan interface{})
		store[n] = dstore
	}

	dstore := store[n].(kernel.DataStore)
	//dstore := store[n].(map[string]chan interface{})
	if dstore != nil {
		return &datastore{dstore}
	}

	return nil
}