msgbus

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WildCardTopic string = "*"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Name string
	Data string // XXX interface{}? serialized data?
}

Event struct is used in two places:

  1. Subscribing: an event's name is used as the underlying topic in EventBus
  2. Publishing: an even't name is needed for the topic to publish to, and the event data is what get's published on the EventBus under that topic

func NewEvent

func NewEvent(name string, data string) *Event

type MsgBus

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

func NewMsgBus

func NewMsgBus() *MsgBus

func (*MsgBus) Publish

func (m *MsgBus) Publish(event *Event)

func (*MsgBus) Subscribe

func (m *MsgBus) Subscribe(eventName string, fn interface{})

func (*MsgBus) Topics

func (m *MsgBus) Topics() []string

type Topics

type Topics struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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