nats

package
v1.15.5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewConn

func NewConn(ctx context.Context, plugins ...Plugin) (*nats.Conn, error)

NewConn returns a new connection with default options.

func NewConnWithConfigPath

func NewConnWithConfigPath(ctx context.Context, path string) (*nats.Conn, error)

NewConnWithConfigPath returns a new nats connection with options from config path.

func NewConnWithOptions

func NewConnWithOptions(ctx context.Context, options *Options, plugins ...Plugin) (*nats.Conn, error)

NewConnWithOptions registers a nats connection.

Types

type Options

type Options struct {
	Url                  string
	MaxReconnects        int
	ReconnectWait        time.Duration
	ReconnectJitter      time.Duration
	ReconnectJitterTLS   time.Duration
	Timeout              time.Duration
	PingInterval         time.Duration
	MaxPingOut           int
	MaxChanLen           int
	ReconnectBufSize     int
	DrainTimeout         time.Duration
	Verbose              bool
	Compression          bool
	RetryOnFailedConnect bool
}

Options nats connection options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals a given key path into options and returns it.

type Plugin

type Plugin func(context.Context) (func(context.Context, *nats.Conn) error, func(context.Context, []nats.Option) ([]nats.Option, error))

Plugin defines a function to process plugin.

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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