nats

package
v3.0.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 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, error)

New 初始化新的nats实例

Types

type Conf

type Conf struct {
	Enable    bool     `yaml:"enable" toml:"enable" json:"enable" default:"false"` //是否启用
	Endpoints []string `yaml:"endpoints" toml:"endpoints" json:"endpoints"`        //服务实例列表
	Username  string   `yaml:"username" toml:"username" json:"username"`           //用户名
	Password  string   `yaml:"password" toml:"password" json:"password"`           //密码
}

Conf 配置

<yaml example>

nats_conf:

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

<toml example>

::nats配置::

[nats_conf]

服务实例地址

endpoints = ["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