nats

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	RequestTimeout time.Duration
	URL            string
	Creds          string
	ClientCert     string
	ClientKey      string
	RootCAs        []string
	Logger         logger.Logger
	BufferSize     int
	// contains filtered or unexported fields
}

Client holds a client connection to a nats server.

func (*Client) Close

func (c *Client) Close()

Close closes the client connection.

func (*Client) Connect

func (c *Client) Connect() error

Connect creates a connection to the nats server.

func (*Client) Debugf

func (c *Client) Debugf(format string, v ...interface{})

Debugf writes a formatted debug message

func (*Client) IsClosed

func (c *Client) IsClosed() bool

IsClosed tests if the client connection has been closed.

func (*Client) Logf

func (c *Client) Logf(format string, v ...interface{})

Logf writes a formatted log message

func (*Client) SendRequest

func (c *Client) SendRequest(subj string, payload []byte, cb mq.Response)

SendRequest sends a request to the MQ.

func (*Client) SetClosedHandler

func (c *Client) SetClosedHandler(cb func(error))

SetClosedHandler sets the handler when the connection is closed

func (*Client) Subscribe

func (c *Client) Subscribe(namespace string, cb mq.Response) (mq.Unsubscriber, error)

Subscribe to all events on a resource namespace. The namespace has the format "event."+resource

func (*Client) Tracef

func (c *Client) Tracef(format string, v ...interface{})

Tracef writes a formatted trace message

type Subscription

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

Subscription implements the mq.Unsubscriber interface.

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe() error

Unsubscribe removes the subscription.

Jump to

Keyboard shortcuts

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