enats

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 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 {
	Debug            bool
	Trace            bool
	Name             string
	ServiceAddr      string
	ClusterAddr      string
	ClusterName      string
	GatewayAddr      string
	GatewayAdvertise string
	Gateways         []string
	Routes           []string
	JetStream        bool
	StoreDir         string
	// Seconds to wait for JetStream to become ready (can take a lot of time when connecting to a cluster)
	JetStreamReadyTimeout int
}

Config represents NATS service configuration

func NewConfig

func NewConfig() Config

NewConfig returns defaults for NATSServiceConfig

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