microbus

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterSubscriptionsOnBus

func RegisterSubscriptionsOnBus(subscriptionList map[string]func(event DataEvent), bus *EventBus)

Types

type DataChannel

type DataChannel chan DataEvent

DataChannel is a channel which can accept an DataEvent

type DataChannelSlice

type DataChannelSlice []DataChannel

DataChannelSlice is a slice of DataChannels

type DataEvent

type DataEvent struct {
	Ctx   context.Context
	Data  interface{}
	Topic string
}

type EventBus

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

EventBus stores the information about subscribers interested for // a particular topic

func NewMicrobus

func NewMicrobus() *EventBus

func (*EventBus) Fire

func (eb *EventBus) Fire(ctx context.Context, topic string, data interface{})

func (*EventBus) Subscribe

func (eb *EventBus) Subscribe(topic string, ch DataChannel)

Jump to

Keyboard shortcuts

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