notifications

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT, Apache-2.0, MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubscribeOn

func SubscribeOn(p Subscribable, topic Topic, notifee Notifee)

SubscribeOn subscribes to the given subscribe on the given topic, but maps to a differnt topic specified in a notifee which has a mappable subscriber

Types

type Event

type Event interface{}

Event is a publishable event

func IdentityTransform

func IdentityTransform(ev Event) Event

IdentityTransform sets up an event transform that makes no changes

type EventTransform

type EventTransform func(Event) Event

EventTransform if a fucntion transforms one kind of event to another

type MappableSubscriber

type MappableSubscriber interface {
	Subscriber
	Map(sourceID Topic, destinationID Topic)
}

MappableSubscriber is a subscriber that remaps events received to other topics and events

func NewMappableSubscriber

func NewMappableSubscriber(sub Subscriber, eventTransform EventTransform) MappableSubscriber

NewMappableSubscriber produces a subscriber that will transform events and topics before passing them on to the given subscriber

type Notifee

type Notifee struct {
	Topic      Topic
	Subscriber MappableSubscriber
}

Notifee is a mappable suscriber where you want events to appear on this specified topic (used to call SubscribeOn to setup a remapping)

type Publisher

type Publisher interface {
	Close(Topic)
	Publish(Topic, Event)
	Shutdown()
	Startup()
	Subscribable
}

Publisher is an publisher of events that can be subscribed to

func NewPublisher

func NewPublisher() Publisher

NewPublisher returns a new message event publisher

type Subscribable

type Subscribable interface {
	Subscribe(topic Topic, sub Subscriber) bool
	Unsubscribe(sub Subscriber) bool
}

Subscribable is a stream that can be subscribed to

type Subscriber

type Subscriber interface {
	OnNext(Topic, Event)
	OnClose(Topic)
}

Subscriber is a subscriber that can receive events

type Topic

type Topic interface{}

Topic is a topic that events appear on

Jump to

Keyboard shortcuts

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