broker

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingMQTTClient

type BlockingMQTTClient interface {
	Subscribe(string, byte, mqtt.MessageHandler) error
	Unsubscribe(...string) error
	Publish(string, byte, bool, []byte) error
}

type Broker

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

func NewBroker

func NewBroker(ctx context.Context, cli BlockingMQTTClient) (*Broker, error)

func NewMQTTBroker

func NewMQTTBroker(ctx context.Context, u string) (*Broker, error)

func (*Broker) HandleOnConnect

func (b *Broker) HandleOnConnect(cli mqtt.Client)

func (*Broker) Publish

func (b *Broker) Publish(evt *eventsv1.Event) error

func (*Broker) Subscribe

func (b *Broker) Subscribe(typeUrl string, msgs chan *eventsv1.Event)

func (*Broker) UnsubscribeAll

func (b *Broker) UnsubscribeAll(msgs chan *eventsv1.Event)

type Subscriber

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

func NewSubscriber

func NewSubscriber(stream SubscriberStream, broker *Broker) *Subscriber

func (*Subscriber) Handle

func (s *Subscriber) Handle(ctx context.Context) error

type SubscriberStream

type SubscriberStream interface {
	Send(*eventsv1.Event) error
	Receive() (*eventsv1.SubscribeRequest, error)
	Peer() connect.Peer
}

Jump to

Keyboard shortcuts

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