pubsub

package
v0.0.0-...-db8cdb6 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

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

发布者对象

func NewPublisher

func NewPublisher(publishTimeout time.Duration, buffer int) *Publisher

构建一个发布者对象,可以设置发布超时时间和缓存队列的长度

func (*Publisher) Close

func (p *Publisher) Close()

关闭发布者对象,同事关闭所有的订阅者管道

func (*Publisher) Evict

func (p *Publisher) Evict(sub chan interface{})

退出订阅

func (*Publisher) Publish

func (p *Publisher) Publish(v interface{})

发布一个主题

func (*Publisher) Subscribe

func (p *Publisher) Subscribe() chan interface{}

添加一个新的订阅者,订阅全部主题

func (*Publisher) SubscribeTopic

func (p *Publisher) SubscribeTopic(topic topicFunc) chan interface{}

添加一个订阅者,订阅过滤器筛选后的主题

Jump to

Keyboard shortcuts

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