event

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TODO: implement distrbuted broker
	Broker broker = newMemoryBroker()
)

Functions

func Init

func Init(addr string) error

func Publish

func Publish(topic string, ev interface{}) error

func Query

func Query(topic string, request, response interface{}) error

func Unsubscribe

func Unsubscribe(s *Subscriber) error

Types

type Request

type Request struct {
	Topic string
	Reply string
	Body  []byte
}

type Response

type Response struct {
	Body  []byte
	Error string
}

type Subscriber

type Subscriber struct {
	ID    string
	Topic string
	Chan  chan []byte
	Exit  chan bool

	sync.RWMutex
	Queue [][]byte
}

func Subscribe

func Subscribe(topic string) (*Subscriber, error)

func (*Subscriber) Close

func (s *Subscriber) Close() error

func (*Subscriber) Next

func (s *Subscriber) Next(ctx context.Context, ev interface{}) error

Jump to

Keyboard shortcuts

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