Alerting: Add integration test case for email channel (#36029)

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
Ganesh Vernekar
2021-06-24 20:31:29 +05:30
committed by GitHub
parent 4f84a09286
commit f2bb3faea8
2 changed files with 81 additions and 11 deletions
+9
View File
@@ -171,6 +171,11 @@ func (b *InProcBus) AddHandlerCtx(handler HandlerFunc) {
b.handlersWithCtx[queryTypeName] = handler
}
// GetHandlerCtx returns the handler function for the given struct name.
func (b *InProcBus) GetHandlerCtx(name string) HandlerFunc {
return b.handlersWithCtx[name]
}
func (b *InProcBus) AddEventListener(handler HandlerFunc) {
handlerType := reflect.TypeOf(handler)
eventName := handlerType.In(0).Elem().Name()
@@ -211,6 +216,10 @@ func Publish(msg Msg) error {
return globalBus.Publish(msg)
}
func GetHandlerCtx(name string) HandlerFunc {
return globalBus.(*InProcBus).GetHandlerCtx(name)
}
func ClearBusHandlers() {
globalBus = New()
}