nats

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxReconnectDefault -  max reconnect try cnt.
	MaxReconnectDefault = -1 // infinity

	// ReconnectWaitDefault - reconnect w8 timeout default value.
	ReconnectWaitDefault = 5 * time.Second

	// ReconnectJitterDefault -  reconnect w8 jitter timeout default value.
	ReconnectJitterDefault = time.Second * 1

	// ReconnectJitterTLSDefault -  reconnect w8 jitter TLS timeout default value.
	ReconnectJitterTLSDefault = time.Second * 2
)

Variables

View Source
var DefaultDSN = []URL{nats.DefaultURL}

DefaultDSN - default nats url and port.

View Source
var ErrEmptyMsg = errors.New("empty msg. nats msg is nil")

ErrEmptyMsg - empty msg. nats msg is nil.

Functions

func New

func New(dsn []URL, options ...Option) (*client, error)

New - main "constructor" function. nolint golint

func NewDefaultClient

func NewDefaultClient() *client

NewDefaultClient empty default client. nolint golint

Types

type Conn

type Conn = nats.Conn

Conn - nats.Conn struct.

type Handler

type Handler = func(*Msg, Serializable) Serializable

Handler - pure NATS Msg, request reply.

type Msg

type Msg = nats.Msg

Msg - nats.Msg.

type MsgHandler

type MsgHandler = nats.MsgHandler

MsgHandler - nats.MsgHandler.

type Option

type Option = nats.Option

Option - nats.Msg.

type PureNatsConnI

type PureNatsConnI interface {
	RequestWithContext(ctx context.Context, subj string, data []byte) (*Msg, error)
	Subscribe(subj string, msgHandler MsgHandler) (*Subscription, error)
	QueueSubscribe(subj string, queueGroup string, msgHandler MsgHandler) (*Subscription, error)
	Drain() error
	Close()
}

PureNatsConnI - pure nats conn interface.

type QueueGroup

type QueueGroup string

QueueGroup - queue group name.

type Serializable

type Serializable = serializable.Serializable

Serializable - serializable.

type SimpleNatsClientI

type SimpleNatsClientI interface {
	UseCustomLogger(logger.Logger)
	Ping(context.Context, Subj) (bool, error)
	PongHandler(Subj) (*Subscription, error)
	PongQueueHandler(Subj, QueueGroup) (*Subscription, error)
	Request(context.Context, Subj, Serializable, Serializable) error
	ReplyHandler(Subj, Serializable, Handler) (*Subscription, error)
	ReplyQueueHandler(Subj, QueueGroup, Serializable, Handler) (*Subscription, error)
	NatsConn() *Conn
	Close() error
}

SimpleNatsClientI _ .

type Subj

type Subj string

Subj - topic name.

type Subscription

type Subscription = nats.Subscription

Subscription - nats.Subscription.

type URL

type URL = string // dsn url like this -> "nats://127.0.0.1:4222"

URL - url name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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