feat(middle-msg): update push middle-msg

This commit is contained in:
bandl 2021-10-19 16:38:07 +08:00
parent 4413ee6f92
commit 623373f7ac
3 changed files with 11 additions and 7 deletions

View File

@ -29,8 +29,8 @@ func SendMiddleMsg(
eventName = LruCleanContextName
case *LruTTlContext:
eventName = LruTTlContextName
case *PulginsInfo:
eventName = PulginsInfoname
case *PulginsInfos:
eventName = PulginsInfosName
}
msgEvent := event.NewEvent(eventName)

View File

@ -5,7 +5,7 @@ import (
)
const (
PulginsInfoname = "plugins-info-context"
PulginsInfosName = "plugins-infos-context"
)
type PulginsInfo struct {
@ -15,3 +15,7 @@ type PulginsInfo struct {
Statux string
Time time.Duration
}
type PulginsInfos struct {
Infos []*PulginsInfo
}

View File

@ -12,7 +12,7 @@ type MiddleWare struct {
eventDriver event.DriverInterface
eventConsumer event.ConsumerInterface
eventProduce event.ProduceInterface
plugins map[string][]plugins.MiddleToolsInterface
plugins map[string][]plugins.PluginInterface
consumerCount int
driverCount int
}
@ -31,8 +31,8 @@ func NewMiddleWare() *MiddleWare {
}
middleWareDriver.loadPlugins()
// 多消费 middle
middleWareDriver.startWork()
})
return middleWareDriver
}
@ -46,10 +46,10 @@ func (m *MiddleWare) loadPlugins() {
pluginsMap := config.GetMiddlewareMap()
pluginsContext := make(map[string][]plugins.MiddleToolsInterface)
pluginsContext := make(map[string][]plugins.PluginInterface)
for msg, pluNames := range plug {
pulgSingle := make([]plugins.MiddleToolsInterface, 0)
pulgSingle := make([]plugins.PluginInterface, 0)
for _, name := range pluNames {
pulgSingle = append(pulgSingle, pluginsMap[name])
}