pubsub

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter added in v1.3.0

type Filter func(msg interface{}) bool

Filter is a function to filter out messages before they reach a subscriptions primary Handler

type Handler added in v1.3.0

type Handler func(msg interface{}) bool

Handler is the function executed against the inbound message in a subscription

type PubSub

type PubSub interface {
	// Publish publishes the object to the channel by name
	Publish(channel string, obj interface{}) error
	// Subscribe subscribes to the given channel until the context is cancelled.
	Subscribe(ctx context.Context, channel string, handler Handler, opts ...SubOpt) error
	// Close closes all subscriptions
	Close()
}

PubSub is used to asynchronously pass messages between routines.

func NewPubSub

func NewPubSub() PubSub

type SubOpt added in v1.4.0

type SubOpt func(options *SubOptions)

func WithFilter added in v1.4.0

func WithFilter(filter Filter) SubOpt

type SubOptions added in v1.4.0

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

Jump to

Keyboard shortcuts

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