pubsub

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed      = errors.New("pub/sub is closed")
	ErrNoSubscribe = errors.New("no subscribe")
)

Functions

This section is empty.

Types

type Message

type Message interface{}

type MessageCallback

type MessageCallback func(Message)

type MessageChan

type MessageChan chan Message

type OptionFunc

type OptionFunc func(*Options)

func WithBufferSize

func WithBufferSize(size int) OptionFunc

type Options

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

type PubSub

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

func New

func New(optionFunc ...OptionFunc) *PubSub

func (*PubSub) Close

func (pb *PubSub) Close()

func (*PubSub) Publish

func (pb *PubSub) Publish(topic string, data interface{}) error

func (*PubSub) Subscribe

func (pb *PubSub) Subscribe(topic string, callback MessageCallback) error

func (*PubSub) Wait

func (pb *PubSub) Wait()

Jump to

Keyboard shortcuts

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