v0

package
v1.2.24041 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPub

type IPub interface {
	Pub(topic string, max int, args ...interface{}) int
}

type ISub

type ISub interface {
	Sub(id, topic string, cb func(id, topic string, args ...interface{}) (ok bool))
}

type IUnsub

type IUnsub interface {
	Unsub(id, topic string) bool
}

type SubFunc

type SubFunc = func(id, topic string, args ...interface{}) (ok bool)

type SubTopicItem

type SubTopicItem struct {
	// contains filtered or unexported fields
}

type Subscribe

type Subscribe struct {
	// contains filtered or unexported fields
}

订阅中心,

func NewSubscribe

func NewSubscribe() *Subscribe

func NewSubscribeEx

func NewSubscribeEx(routeParseFunc func(topic string) interface{}, routeMatchFunc func(route interface{}, topic interface{}) bool) *Subscribe

func (*Subscribe) Close

func (this *Subscribe) Close() error

func (*Subscribe) Count

func (this *Subscribe) Count() int

func (*Subscribe) GetTopicSubCount

func (this *Subscribe) GetTopicSubCount(topic string) int

func (*Subscribe) Pub

func (this *Subscribe) Pub(topic string, max int, args ...interface{}) int

max:0, 全部投递 >1 投递成功max次后停止 循环map

utils_subscribe_v2._test.go:168: 34228, 6844/s
utils_subscribe_v2._test.go:168: 68952, 6894/s

循环lst

utils_subscribe_v2._test.go:168: 35343, 6977/s
utils_subscribe_v2._test.go:168: 71194, 7072/s

向主题订阅者推送数据 topic推送的主题 max最大接收者,超过该值不再进行推送

func (*Subscribe) Status

func (this *Subscribe) Status() string

func (*Subscribe) StatusDetail

func (this *Subscribe) StatusDetail() string

func (*Subscribe) Sub

func (this *Subscribe) Sub(id, topic string, cb func(id, topic string, args ...interface{}) (ok bool))

订阅一个主题

topic订阅主题,为空不进行订阅 id订阅者id,topic 下id重复将会被覆盖(之前订阅失效)

func (*Subscribe) TopicCount

func (this *Subscribe) TopicCount() int

func (*Subscribe) Unsub

func (this *Subscribe) Unsub(id, topic string) bool

取消订阅 id 订阅时传入的id topic订阅的主题

Jump to

Keyboard shortcuts

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