eventhub

package
v1.13.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 4 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// InstanceEventTopic 服务发现事件主题
	InstanceEventTopic = "instance_event"
)

事件主题

Variables

This section is empty.

Functions

func InitEventHub

func InitEventHub()

InitEventHub initialize event hub

func Publish

func Publish(topic string, event Event)

Publish pushlish event to topic @param topic Topic name @param event Event object

func Shutdown

func Shutdown()

Shutdown shutdown event hub

func Subscribe

func Subscribe(topic string, name string, handler Handler, opts ...SubOption) error

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 Unsubscribe

func Unsubscribe(topic string, name string)

Unsubscribe unsubscribe topic @param topic Topic name @param name Subscribe name

Types

type Event

type Event interface{}

Event evnt type

type Handler

type Handler func(context.Context, interface{}) error

Handler event handler

type SubOption

type SubOption func(s *SubOptions)

SubOption subscription option func

func WithQueueSize

func WithQueueSize(size int) SubOption

WithQueueSize set event queue size

type SubOptions

type SubOptions struct {
	QueueSize int
}

SubOptions subscripion options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL