Documentation
¶
Index ¶
- Constants
- func InitEventHub()
- func Publish(topic string, event Event)
- func Shutdown()
- func Subscribe(topic string, name string, handler Handler, opts ...SubOption) error
- func TestInitEventHub()
- func TestShutdownEventHub()
- func Unsubscribe(topic string, name string)
- type Event
- type Handler
- type SubOption
- type SubOptions
Constants ¶
View Source
const ( // InstanceEventTopic 服务发现事件主题 InstanceEventTopic = "instance_event" // LeaderChangeEventTopic LeaderChangeEventTopic = "leader_change_event" )
事件主题
Variables ¶
This section is empty.
Functions ¶
func Subscribe ¶
Subscribe subscribe topic @param topic Topic name @param name Subscribe name @param handler Message handler @param opts Subscription options @return error Subscribe failed, return error
func TestInitEventHub ¶ added in v1.17.0
func TestInitEventHub()
func TestShutdownEventHub ¶ added in v1.17.0
func TestShutdownEventHub()
func Unsubscribe ¶
Unsubscribe unsubscribe topic @param topic Topic name @param name Subscribe name
Types ¶
type Handler ¶
type Handler interface { // PreProcess do preprocess logic for event PreProcess(context.Context, any) any // OnEvent event process logic OnEvent(ctx context.Context, any2 any) error }
Handler event handler
Click to show internal directories.
Click to hide internal directories.