forked from p93542168/wheat-cache
feat(middle-msg): update push middle-msg
This commit is contained in:
parent
4413ee6f92
commit
623373f7ac
|
@ -29,8 +29,8 @@ func SendMiddleMsg(
|
|||
eventName = LruCleanContextName
|
||||
case *LruTTlContext:
|
||||
eventName = LruTTlContextName
|
||||
case *PulginsInfo:
|
||||
eventName = PulginsInfoname
|
||||
case *PulginsInfos:
|
||||
eventName = PulginsInfosName
|
||||
}
|
||||
|
||||
msgEvent := event.NewEvent(eventName)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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])
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue