pubsub

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelPrefix   = "rumors.event."
	ChannelArticles = ChannelPrefix + "articles"
	ChannelTg       = ChannelPrefix + "telegram"

	OpMarshal = "pubsub: marshal"
	OpPublish = "pubsub: publish"
	OpClose   = "pubsub: close"
)
View Source
const PluginName = "pubsub"

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

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

func (*Plugin) Init

func (p *Plugin) Init(rdbMaker common.RedisMaker, log logger.Logger) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Provides

func (p *Plugin) Provides() []*dep.Out

func (*Plugin) Pub

func (p *Plugin) Pub() common.Pub

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

func (*Plugin) Stop

func (p *Plugin) Stop(context.Context) error

func (*Plugin) Sub

func (p *Plugin) Sub() common.Sub

type Publisher

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

func NewPublisher

func NewPublisher(rdbMaker common.RedisMaker, logger *slog.Logger) (*Publisher, error)

func (*Publisher) Articles

func (p *Publisher) Articles(ctx context.Context, articles []model.Article)

func (*Publisher) Close

func (p *Publisher) Close() error

func (*Publisher) Telegram

func (p *Publisher) Telegram(ctx context.Context, message any)

type Subscriber

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

func NewSubscriber

func NewSubscriber(rdbMaker common.RedisMaker) (*Subscriber, error)

func (*Subscriber) All

func (s *Subscriber) All(ctx context.Context) *redis.PubSub

func (*Subscriber) Articles

func (s *Subscriber) Articles(ctx context.Context) *redis.PubSub

func (*Subscriber) Close

func (s *Subscriber) Close() (err error)

func (*Subscriber) Telegram

func (s *Subscriber) Telegram(ctx context.Context) *redis.PubSub

Jump to

Keyboard shortcuts

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