pubsub

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProcessorTimeout = errors.New("failed to send message because of timeout")
)
View Source
var (
	ErrPubsubTimeout = errors.New("failed to send message to topic because of timeout")
)

Functions

This section is empty.

Types

type Handler

type Handler interface {
	OnMessage(interface{}) error
	OnTimeout() error
}

type Processor

type Processor interface {
	Start()
	Close()
}

func NewProcessor

func NewProcessor(ch <-chan interface{}, timeout time.Duration, handler Handler) Processor

type Pubsub

type Pubsub interface {
	Publish(topic string, msg interface{}) error
	Subscribe(topic string) (<-chan interface{}, error)
	Unsubscribe(topic string, ch <-chan interface{}) error
	io.Closer
}

func NewPubsub

func NewPubsub(size int) (Pubsub, error)

Jump to

Keyboard shortcuts

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