nats

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstance

func GetInstance() *natsLib.Conn

GetInstance 获取链接实例

func Init

func Init(conf Conf)

Init 初始化

func New

func New(conf Conf) *natsLib.Conn

New 初始化新的nats实例

Types

type Conf

type Conf struct {
	Servers  []string `yaml:"servers" toml:"servers" json:"servers"`    //服务实例列表
	Username string   `yaml:"username" toml:"username" json:"username"` //用户名
	Password string   `yaml:"password" toml:"password" json:"password"` //密码
}

Conf 配置

<yaml example>

nats:

servers:
  - "nats://127.0.0.1:4222"
username: admin
password: changeMe

<toml example>

::nats配置::

nats

服务实例地址

servers = ["nats://127.0.0.1:4222"]

认证用户名

username = "admin"

认证密码

password = "changeMe"

Jump to

Keyboard shortcuts

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