notification

package
v1.1.145 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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