channel

package
v0.0.0-...-26e86c7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOperationCanceled       = errors.New("operation canceled")
	ErrAlreadyClosed           = errors.New("subscription already closed")
	ErrCommandBufferExceeded   = errors.New("can't handle anymore command, buffer exceeded")
	ErrPublishBufferExceeded   = errors.New("can't handle anymore publish, buffer exceeded")
	ErrSubscribeBufferExceeded = errors.New("can't send to the subscriber, buffer exceeded")
	ErrStopped                 = errors.New("channel broker stopped")
)

Functions

This section is empty.

Types

type Broker

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

func New

func New(opts ...Options) *Broker

func (*Broker) Close

func (b *Broker) Close(ctx context.Context) error

func (*Broker) Init

func (b *Broker) Init(ctx context.Context, c config.Config) error

func (*Broker) Publish

func (b *Broker) Publish(ctx context.Context, topic string, payload event.Payload) event.Publishing

func (*Broker) Run

func (b *Broker) Run(ctx context.Context) error

func (*Broker) Start

func (b *Broker) Start(ctx context.Context) app.Waiter

func (*Broker) Subscribe

func (b *Broker) Subscribe(ctx context.Context, topic string) event.SubscriptionMsg

func (*Broker) SubscribeHandler

func (b *Broker) SubscribeHandler(ctx context.Context, topic string, handler event.MessageHandler) event.Subscription

type Config

type Config struct {
	WaitOnClose   bool `mapstructure:"wait_on_close"`
	CmdBufferSize int  `mapstructure:"cmd_buffer_size"`
	PubBufferSize int  `mapstructure:"pub_buffer_size"`
	SubBufferSize int  `mapstructure:"sub_buffer_size"`
}

type Options

type Options interface {
	Configure(b *Broker)
}

type OptionsFunc

type OptionsFunc func(b *Broker)

func WithConfig

func WithConfig(config Config) OptionsFunc

func WithRunOnInit

func WithRunOnInit(runOnInit bool) OptionsFunc

func (OptionsFunc) Configure

func (f OptionsFunc) Configure(b *Broker)

Jump to

Keyboard shortcuts

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