pubsub

package
v0.0.0-...-3afac47 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, p PubQueue) context.Context

Types

type Pub

type Pub struct {
	RedisClient *redis.Client
	Logger      *zap.Logger
}

func (*Pub) Pub

func (bq *Pub) Pub(channel, message string)

type PubQueue

type PubQueue interface {
	Pub(channel, message string)
}

func FromContext

func FromContext(ctx context.Context) PubQueue

func NewPub

func NewPub(redisClient *redis.Client, logger *zap.Logger) PubQueue

type Sub

type Sub struct {
	RedisClient *redis.Client
	Logger      *zap.Logger
	// contains filtered or unexported fields
}

func NewSub

func NewSub(redisClient *redis.Client, logger *zap.Logger, queueNum int) *Sub

func (*Sub) RegisterSub

func (bq *Sub) RegisterSub(sqs ...SubQueue)

func (*Sub) Sub

func (bq *Sub) Sub(ctx context.Context)

type SubQueue

type SubQueue interface {
	Channel() string
	Process(ctx context.Context, message string)
}

Jump to

Keyboard shortcuts

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