nats

package
v0.0.0-...-b463ae7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package nats provides connectivity implementation based on nats client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(
	ctx context.Context,
	handleCmd types.AgentCmdHandleFunc,
	cfg interface{},
) (_ client.Interface, err error)

Types

type Client

type Client struct {
	*clientutil.BaseClient
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect(dialCtx context.Context) error

func (*Client) PostMsg

func (c *Client) PostMsg(msg *aranyagopb.Msg) error

func (*Client) Start

func (c *Client) Start(appCtx context.Context) error

type Config

type Config struct {
	clientutil.CommonConfig `json:",inline" yaml:",inline"`

	PingInterval time.Duration `json:"pingInterval" yaml:"pingInterval"`

	SubjectNamespace string `json:"subjectNamespace" yaml:"subjectNamespace"`

	// ClusterID of the nats streaming server
	ClusterID string `json:"clusterID" yaml:"clusterID"`

	// ClientID of the nats streaming client, will also be used as nats
	// client Name (which is an optional name label sent to the server
	// on CONNECT to identify the client)
	ClientID string `json:"clientID" yaml:"clientID"`

	MaxPendingPubAck int `json:"maxPendingPubAck" yaml:"maxPendingPubAck"`

	// AckWait time to wait before resend message (both client and server)
	AckWait time.Duration `json:"ackWait" yaml:"ackWait"`

	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
	Token    string `json:"token" yaml:"token"`

	NKey string `json:"nkey" yaml:"nkey"`
	JWT  string `json:"jwt" yaml:"jwt"`
}

Jump to

Keyboard shortcuts

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