messaging

package
v0.1.46 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

func NewBroker

func NewBroker(cfg config.CfgManager, domain string, service string) (*Broker, error)

func (*Broker) Connect

func (b *Broker) Connect() error

func (*Broker) Disconnect

func (b *Broker) Disconnect() error

func (*Broker) Publish

func (b *Broker) Publish(topic string, data Event) error

func (*Broker) PublishStream

func (b *Broker) PublishStream(topic string, data Event) error

func (*Broker) WithStream

func (b *Broker) WithStream(topics []string) error

type Consumer added in v0.1.39

type Consumer interface {
	Handle(ctx context.Context, msg Message) error
}

type Event

type Event interface {
	Name() string
}

type Message

type Message struct {
	Name string `json:"name"`
	Data []byte `json:"data"`
}

type Subscriber

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

func NewSubscriber

func NewSubscriber(broker *Broker) *Subscriber

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(ctx context.Context, domain string, service string, topic string, handler func(ctx context.Context, msg Message) error) error

func (*Subscriber) SubscribeStream

func (s *Subscriber) SubscribeStream(ctx context.Context, domain string, service string, topic string, handler func(ctx context.Context, msg Message) error) error

type Worker added in v0.1.41

type Worker interface {
	Run(consumer Consumer) func(ctx context.Context, domain string, service string, topic string) error
}

func NewWorker added in v0.1.41

func NewWorker(broker *Broker) Worker

Jump to

Keyboard shortcuts

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