nats

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ReadyForConnectionsTimeout = 5 * time.Second

Variables

This section is empty.

Functions

func RoutesFromSlice

func RoutesFromSlice(routes []string, allowLocal bool) ([]*url.URL, error)

RoutesFromSlice parses route URLs from a slice of strings

func RoutesFromStr

func RoutesFromStr(routesStr string, allowLocal bool) ([]*url.URL, error)

RoutesFromStr parses route URLs from a string e.g. "nats://localhost:4222,nats://localhost:4223"

Types

type ClientManager

type ClientManager struct {
	Client *nats.Conn
}

func NewClientManager

func NewClientManager(ctx context.Context, servers string, options ...nats.Option) (*ClientManager, error)

NewClientManager is a helper function to create a NATS client connection with a given name and servers string

func (*ClientManager) GetDebugInfo

func (cm *ClientManager) GetDebugInfo(ctx context.Context) (model.DebugInfo, error)

DebugInfo returns the debug info of the NATS client

func (*ClientManager) Stop

func (cm *ClientManager) Stop()

Stop stops the NATS client

type ServerManager

type ServerManager struct {
	Server *server.Server
}

ServerManager is a helper struct to manage a NATS server

func NewServerManager

func NewServerManager(ctx context.Context, params ServerManagerParams) (*ServerManager, error)

NewServerManager is a helper function to create a NATS server with a given options

func (*ServerManager) GetDebugInfo

func (sm *ServerManager) GetDebugInfo(ctx context.Context) (model.DebugInfo, error)

GetDebugInfo returns the debug info of the NATS server

func (*ServerManager) Stop

func (sm *ServerManager) Stop()

Stop stops the NATS server

type ServerManagerParams

type ServerManagerParams struct {
	Options           *server.Options
	ConnectionTimeout time.Duration
}

type ZeroLogger

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

ZeroLogger is a wrapper around zerolog.Logger to implement the NATS Logger interface

func NewZeroLogger

func NewZeroLogger(logger zerolog.Logger, serverID string) ZeroLogger

NewZeroLogger creates a new ZeroLogger

func (ZeroLogger) Debugf

func (l ZeroLogger) Debugf(format string, v ...interface{})

func (ZeroLogger) Errorf

func (l ZeroLogger) Errorf(format string, v ...interface{})

func (ZeroLogger) Fatalf

func (l ZeroLogger) Fatalf(format string, v ...interface{})

func (ZeroLogger) Noticef

func (l ZeroLogger) Noticef(format string, v ...interface{})

func (ZeroLogger) Tracef

func (l ZeroLogger) Tracef(format string, v ...interface{})

func (ZeroLogger) Warnf

func (l ZeroLogger) Warnf(format string, v ...interface{})

Directories

Path Synopsis
Package stream provides a NATS client for streaming records between clients with asynchronous response handling.
Package stream provides a NATS client for streaming records between clients with asynchronous response handling.

Jump to

Keyboard shortcuts

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