notification

package
v1.1.37 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unsubscribe

func Unsubscribe(name string, id string) error

Unsubscribe - removes the subscriber, indicated by id, from the notifier, indicated by name

Types

type Notifier

type Notifier interface {
	GetName() string
	Stop()
	Subscribe(Subscriber)
	Unsubscribe(string) error
	Start()
}

Notifier - any channel that has the potential to have listeners (1-n)

func RegisterNotifier

func RegisterNotifier(name string, source chan interface{}) (Notifier, error)

RegisterNotifier - accepts a name and source channel to make a new notifier object

type PubSub

type PubSub interface {
	Publish(key, secondarykey string, data interface{}) error
	PublishToTopic(data interface{}) error
	PublishToTopicWithSecondaryKey(secondarykey string, data interface{}) error
	PublishCacheHash(key, secondarykey string, data interface{}) error
	PublishCacheHashToTopic(data interface{}) error
	PublishCacheHashToTopicWithSecondaryKey(secondarykey string, data interface{}) error
	Subscribe() (msgChan chan interface{}, id string)
	SubscribeWithCallback(callback func(data interface{})) (id string)
	Unsubscribe(id string) error
}

PubSub - interface for creating a PubSub library

type Subscriber

type Subscriber interface {
	GetID() string
	SendMsg(interface{})
	Close() // Unsubscribes and closes channel
	// contains filtered or unexported methods
}

Subscriber - subscribes to a notifier

func Subscribe

func Subscribe(name string, output chan interface{}) (Subscriber, error)

Subscribe - subscribes to events on the notifier sending them to the output channel.

Jump to

Keyboard shortcuts

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