dubboex

package
v0.3.70 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONFIG_SERVER = "_viper_config_server" // 配置服务器的键名
	TMP_DIR       = "tmp"                  // 临时文件路径
	TMP_PORT_FILE = "port.txt"             // 临时端口文件路径
)

常量定义

Variables

This section is empty.

Functions

func Get added in v0.3.66

func Get(key string) interface{}

Get 读取配置

func GetById added in v0.3.66

func GetById(name, key string) interface{}

GetById 读取配置

func GetDubboInstance

func GetDubboInstance() *dubbo.Instance

GetDubboInstance 获取Dubbo实例

func InitFrmDubboNacos

func InitFrmDubboNacos() error

func Load

func Load(key string) *viper.Viper

Load 从Map中加载配置

func LoadConfig

func LoadConfig(configPath string) error

LoadConfig 加载配置文件并初始化应用配置和Dubbo实例

func NewInstance

func NewInstance(opts ...dubbo.InstanceOption) error

NewInstance 初始化Dubbo实例

func SetOpts

func SetOpts(opts ...dubbo.InstanceOption)

SetOpts 设置Dubbo实例选项

func Store

func Store(key, val string)

Store 存储配置到Map中

Types

type AppConfig

type AppConfig struct {
	Mode     string      `yaml:"mode"`
	Nacos    NacosConfig `yaml:"nacos"`
	Isremote bool        `yaml:"isremote"`
}

func (AppConfig) DefaultInstanceOptions

func (app AppConfig) DefaultInstanceOptions() []dubbo.InstanceOption

func (AppConfig) GetPort

func (app AppConfig) GetPort() int

GetPort 获取端口 默认从配置文件中获取,其次从缓存文件中获取,最后随机端口

func (AppConfig) NewDubboInstance

func (app AppConfig) NewDubboInstance(opts ...dubbo.InstanceOption) (*dubbo.Instance, error)

type Clientconfig

type Clientconfig struct {
	Appname     string `yaml:"appname"`
	Namespaceid string `yaml:"namespaceid"`
	Password    string `yaml:"password"`
	Username    string `yaml:"username"`
}

type NacosConfig

type NacosConfig struct {
	Clientconfig  Clientconfig    `yaml:"clientconfig"`
	Serverconfigs []Serverconfigs `yaml:"serverconfigs"`
	Service       Service         `yaml:"service"`
}

type Others

type Others struct {
	Groupname   string `yaml:"groupname"`
	Servicename string `yaml:"servicename"`
}

type Serverconfigs

type Serverconfigs struct {
	Grpcport int    `yaml:"grpcport"`
	Ipaddr   string `yaml:"ipaddr"`
	Port     int    `yaml:"port"`
}

type Service

type Service struct {
	Clustername string   `yaml:"clustername"`
	Ephemeral   bool     `yaml:"ephemeral"`
	Groupname   string   `yaml:"groupname"`
	Servicename string   `yaml:"servicename"`
	Weight      int      `yaml:"weight"`
	Others      []Others `yaml:"others"`
	Enable      bool     `yaml:"enable"`
	Healthy     bool     `yaml:"healthy"`
	Ip          string   `yaml:"ip"`
	Port        int      `yaml:"port"`
	MetricPort  int      `yaml:"metricport"`
}

type ViperListener

type ViperListener struct {
	Name  string
	Group string
}

func NewViperListener

func NewViperListener(name string, group string) *ViperListener

func (ViperListener) Parse

func (l ViperListener) Parse(key string, val interface{})

func (ViperListener) Process

func (l ViperListener) Process(event *config_center.ConfigChangeEvent)

Jump to

Keyboard shortcuts

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