enats

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled          bool     `toml:"enabled"`
	Debug            bool     `toml:"debug"`
	Trace            bool     `toml:"trace"`
	Name             string   `toml:"name"`
	ServiceAddr      string   `toml:"service_addr"`
	ClusterAddr      string   `toml:"cluster_addr"`
	ClusterName      string   `toml:"cluster_name"`
	GatewayAddr      string   `toml:"gateway_addr"`
	GatewayAdvertise string   `toml:"gateway_advertise"`
	Gateways         []string `toml:"gateways"`
	Routes           []string `toml:"routes"`
	JetStream        bool     `toml:"jetstream"`
	StoreDir         string   `toml:"jetstream_store_dir"`
	// Seconds to wait for JetStream to become ready (can take a lot of time when connecting to a cluster)
	JetStreamReadyTimeout int `toml:"jetstream_ready_timeout"`
}

Config represents NATS service configuration

func NewConfig

func NewConfig() Config

NewConfig returns defaults for NATSServiceConfig

func (Config) ToToml added in v1.5.4

func (c Config) ToToml() string

type LogEntry

type LogEntry struct {
	*slog.Logger
}

LogEntry represents LoggerV2 decorator for nats server logger

func (*LogEntry) Debugf added in v1.5.0

func (e *LogEntry) Debugf(format string, v ...interface{})

Debugf is an alias for Debug

func (*LogEntry) Errorf added in v1.5.0

func (e *LogEntry) Errorf(format string, v ...interface{})

Errorf is an alias for Error

func (*LogEntry) Fatalf added in v1.5.0

func (e *LogEntry) Fatalf(format string, v ...interface{})

Fatalf is an alias for Fatal

func (*LogEntry) Infof added in v1.5.0

func (e *LogEntry) Infof(format string, v ...interface{})

Infof is an alias for Info

func (*LogEntry) Noticef

func (e *LogEntry) Noticef(format string, v ...interface{})

Noticef is an alias for Infof

func (*LogEntry) Tracef

func (e *LogEntry) Tracef(format string, v ...interface{})

Tracef is an alias for Debugf

func (*LogEntry) Warnf added in v1.5.0

func (e *LogEntry) Warnf(format string, v ...interface{})

Warnf is an alias for Warn

type Service

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

Service represents NATS service

func NewService

func NewService(c *Config, l *slog.Logger) *Service

NewService returns an instance of NATS service

func (*Service) Description

func (s *Service) Description() string

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

Shutdown shuts the NATS server down

func (*Service) Start

func (s *Service) Start() error

Start starts the service

func (*Service) WaitJetStreamReady added in v1.4.7

func (s *Service) WaitJetStreamReady(maxSeconds int) error

func (*Service) WaitReady

func (s *Service) WaitReady() error

WaitReady waits while NATS server is starting

Jump to

Keyboard shortcuts

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