Documentation ¶
Index ¶
- Constants
- Variables
- func InitEventHub()
- func Publish(topic string, event Event) error
- func RegisterPublisher(topic string, opt PublishOption) error
- func Shutdown()
- type CacheClientEvent
- type CacheInstanceEvent
- type CacheNamespaceEvent
- type Event
- type EventType
- type Handler
- type HandlerFunc
- type PublishConfigFileEvent
- type PublishOption
- type SubOption
- type SubOptions
- type SubscribtionContext
Constants ¶
View Source
const ( // InstanceEventTopic discover event InstanceEventTopic = "instance_event" // LeaderChangeEventTopic leader change LeaderChangeEventTopic = "leader_change_event" // ConfigFilePublishTopic config file release publish ConfigFilePublishTopic = "configfile_publish" // CacheInstanceEventTopic record cache occur instance add/update/del event CacheInstanceEventTopic = "cache_instance_event" // CacheClientEventTopic record cache occur client add/update/del event CacheClientEventTopic = "cache_client_event" // CacheNamespaceEventTopic record cache occur namespace add/update/del event CacheNamespaceEventTopic = "cache_namespace_event" // ClientEventTopic . ClientEventTopic = "client_event" )
事件主题
Variables ¶
View Source
var (
ErrorEventhubNotInitialize = errors.New("eventhub not initialize")
)
Functions ¶
func RegisterPublisher ¶ added in v1.18.0
func RegisterPublisher(topic string, opt PublishOption) error
Types ¶
type CacheClientEvent ¶ added in v1.18.0
type CacheInstanceEvent ¶ added in v1.18.0
type CacheNamespaceEvent ¶ added in v1.18.0
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
type PublishConfigFileEvent ¶ added in v1.17.3
type PublishConfigFileEvent struct {
Message *model.SimpleConfigFileRelease
}
PublishConfigFileEvent 事件对象,包含类型和事件消息
type PublishOption ¶ added in v1.18.0
type PublishOption struct {
WaitHaveSub bool
}
PublishOption .
type SubscribtionContext ¶ added in v1.17.3
type SubscribtionContext struct {
// contains filtered or unexported fields
}
func Subscribe ¶
func Subscribe(topic string, handler Handler, opts ...SubOption) (*SubscribtionContext, error)
Subscribe subscribe topic
func SubscribeWithFunc ¶ added in v1.18.0
func SubscribeWithFunc(topic string, handler HandlerFunc, opts ...SubOption) (*SubscribtionContext, error)
SubscribeWithFunc subscribe topic use func
func (*SubscribtionContext) Cancel ¶ added in v1.17.3
func (s *SubscribtionContext) Cancel()
Click to show internal directories.
Click to hide internal directories.