subscriber

package
v0.0.0-...-97f09c1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(label string, logger *zap.SugaredLogger) *Manager

func (*Manager) Create

func (m *Manager) Create(ctx context.Context, topic string) (*Subscriber, chan struct{}, error)

Create a new subscriber for a given topic. It returns the newly created subscriber and a blocking channel indicating whether there are any subscribers left for the passed topic.

func (*Manager) Get

func (m *Manager) Get(topic string) []*Subscriber

Get returns all subscribers associated with the topic.

func (*Manager) Has

func (m *Manager) Has(topic string) bool

Has returns true if there's at least one subscriber associated with the topic.

func (*Manager) Notify

func (m *Manager) Notify(topic string, data interface{}) error

type Subscriber

type Subscriber struct {
	Notifier     *rpc.Notifier
	Subscription *rpc.Subscription
	Topic        string
}

func New

func New(ctx context.Context, topic string) (*Subscriber, error)

func (*Subscriber) Notify

func (s *Subscriber) Notify(data interface{}) (err error)

Jump to

Keyboard shortcuts

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