feat(runtime/v2): Add pre and post msg handler register (#21346)

This commit is contained in:
son trinh
2024-08-19 10:26:56 +00:00
committed by GitHub
parent c50c6b2549
commit 294b608022
2 changed files with 20 additions and 9 deletions
+12 -8
View File
@@ -19,12 +19,12 @@ type (
// msg handler
type PreMsgRouter interface {
// Register will register a specific message handler hooking into the message with
// RegisterPreHandler will register a specific message handler hooking into the message with
// the provided name.
Register(msgName string, handler PreMsgHandler)
// RegisterGlobal will register a global message handler hooking into any message
RegisterPreHandler(msgName string, handler PreMsgHandler)
// RegisterGlobalPreHandler will register a global message handler hooking into any message
// being executed.
RegisterGlobal(handler PreMsgHandler)
RegisterGlobalPreHandler(handler PreMsgHandler)
}
type HasPreMsgHandlers interface {
@@ -40,11 +40,15 @@ type HasMsgHandlers interface {
}
type PostMsgRouter interface {
// Register will register a specific message handler hooking after the execution of message with
// RegisterPostHandler will register a specific message handler hooking after the execution of message with
// the provided name.
Register(msgName string, handler PostMsgHandler)
// RegisterGlobal will register a global message handler hooking after the execution of any message.
RegisterGlobal(handler PreMsgHandler)
RegisterPostHandler(msgName string, handler PostMsgHandler)
// RegisterGlobalPostHandler will register a global message handler hooking after the execution of any message.
RegisterGlobalPostHandler(handler PostMsgHandler)
}
type HasPostMsgHandlers interface {
RegisterPostMsgHandlers(router PostMsgRouter)
}
// query handler