pubsub

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

type PubSub interface {
	// Publish publishes the object to the channel by name
	Publish(channel string, obj interface{}) error
	// Publish publishes the object to the channel by name to the first N subscribers of the channel
	PublishN(channel string, obj interface{}, n int) error
	// Subscribe subscribes to the given channel until the context is cancelled
	Subscribe(ctx context.Context, channel string, handler func(obj interface{})) error
	// Subscribe subscribes to the given channel until it receives N messages or the context is cancelled
	SubscribeN(ctx context.Context, channel string, n int, handler func(msg interface{})) error
	Close()
}

PubSub is used to asynchronously pass messages between routines.

func NewPubSub

func NewPubSub() PubSub

Jump to

Keyboard shortcuts

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