diff --git a/pkg/middle-msg/define.go b/pkg/middle-msg/define.go index 8e2e68d..aed2e29 100644 --- a/pkg/middle-msg/define.go +++ b/pkg/middle-msg/define.go @@ -29,8 +29,8 @@ func SendMiddleMsg( eventName = LruCleanContextName case *LruTTlContext: eventName = LruTTlContextName - case *PulginsInfo: - eventName = PulginsInfoname + case *PulginsInfos: + eventName = PulginsInfosName } msgEvent := event.NewEvent(eventName) diff --git a/pkg/middle-msg/plugins.go b/pkg/middle-msg/plugins.go index ee92512..b452349 100644 --- a/pkg/middle-msg/plugins.go +++ b/pkg/middle-msg/plugins.go @@ -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 +} diff --git a/pkg/middle/middleware.go b/pkg/middle/middleware.go index 065c615..44a1239 100644 --- a/pkg/middle/middleware.go +++ b/pkg/middle/middleware.go @@ -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]) }