core

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NATSConnectParams

type NATSConnectParams struct {
	// connect to NATS JetStream cluster with this URI
	ServerURI string `validate:"required,uri"`
	// max time to wait for connection in ns
	ConnectTimeout time.Duration
	// on connection failure, max number of reconnect attempt. "-1" means infinite
	MaxReconnectAttempt int `validate:"gte=-1"`
	// wait duration between reconnect attempts
	ReconnectWait time.Duration
	// callback on client disconnect
	OnDisconnectCallback func(*nats.Conn, error)
	// callback on client reconnect
	OnReconnectCallback func(*nats.Conn)
	// callback on client connection closed
	OnCloseCallback func(*nats.Conn)
}

NATSConnectParams contains NATS connection parameters

type NatsClient

type NatsClient struct {
	goutils.Component
	// contains filtered or unexported fields
}

NatsClient is a wrapper around NATS client handle objects

func GetJetStream

func GetJetStream(param NATSConnectParams) (*NatsClient, error)

GetJetStream defines a new NATS client object wrapper

NOTE: Function will also attempt to connect with NATs server

func (*NatsClient) Close

func (js *NatsClient) Close(ctxt context.Context)

Close closes a JetStream client

func (*NatsClient) JetStream

func (js *NatsClient) JetStream() nats.JetStreamContext

JetStream fetches the JetStream client handle

func (*NatsClient) NATs

func (js *NatsClient) NATs() *nats.Conn

NATs fetches the NATs client handle

Jump to

Keyboard shortcuts

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