broker

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 3 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 interface {
	Publish(ctx context.Context, subject string, data []byte) error
	Subscribe(ctx context.Context, subject string, handler func(msg *Message)) (*Subscription, error)
	Request(ctx context.Context, subject string, msg []byte) (*Message, error)
	Drain() error
	Close()
}

type ConcreteNatsBroker

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

func NewNatsBroker

func NewNatsBroker(opts *Options) (*ConcreteNatsBroker, error)

func (*ConcreteNatsBroker) Close

func (n *ConcreteNatsBroker) Close()

func (*ConcreteNatsBroker) Drain

func (n *ConcreteNatsBroker) Drain() error

func (*ConcreteNatsBroker) Publish

func (n *ConcreteNatsBroker) Publish(ctx context.Context, subject string, data []byte) error

func (*ConcreteNatsBroker) Request

func (b *ConcreteNatsBroker) Request(ctx context.Context, subject string, msg []byte) (*Message, error)

func (*ConcreteNatsBroker) Subscribe

func (n *ConcreteNatsBroker) Subscribe(ctx context.Context, subject string, handler func(msg *Message)) (*Subscription, error)

type Message

type Message = nats.Msg

type MuxBroker

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

func NewServeMux

func NewServeMux(b Broker) *MuxBroker

func (*MuxBroker) HandleFunc

func (mux *MuxBroker) HandleFunc(pattern string, handler func(msg *Message))

func (*MuxBroker) Subscribe

func (mux *MuxBroker) Subscribe() error

type Options

type Options struct {
	Servers       []string
	MaxReconnects int
	ReconnectWait time.Duration
}

type Subscription

type Subscription = nats.Subscription

Jump to

Keyboard shortcuts

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