nats

package
v0.0.0-...-d17e12a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNATS       = fmt.Errorf("nats error")
	ErrDispatcher = fmt.Errorf("%w: dispatcher", ErrNATS)
)

Functions

func Publish

func Publish(subject string, msg []byte) error

Publish adds message in queue

func StartDispatcher

func StartDispatcher(options []DispatcherOption) error

StartDispatcher connects to stan and adds durable subscriptions

func StartServer

func StartServer(config Config) error

StartServer runs NATS

func StopDispatcher

func StopDispatcher() error

StopDispatcher ends dispatching

func StopServer

func StopServer()

StopServer shutdowns NATS

Types

type Config

type Config struct {
	AckWait            time.Duration
	LogColors          bool
	MaxInflight        int
	MaxPubAcksInflight int
	MaxPayload         int32
	MonitorPort        int
	StoreDir           string
	StoreType          string
	StoreMaxAge        time.Duration
	StoreMaxBytes      int64
	StoreMaxMsgs       int64

	ConfigFile string
}

Config defines NATS configurable options

type DispatcherOption

type DispatcherOption struct {
	Durable string
	Subject string
	Handler func([]byte) error
}

DispatcherOption defines subscription

Jump to

Keyboard shortcuts

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