discovery

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeRegisterServiceInstance

func DeRegisterServiceInstance(param vo.DeregisterInstanceParam)

func GetInstance added in v0.0.6

func GetInstance(app string) string

func InitDiscovery

func InitDiscovery(discoveryType string, app string, config ...interface{})

InitDiscovery 初始化注册中心

discoveryType 为 eureka 时,config 参数共 4 个,依次为:"用户名", "密码", "eureka地址:7000/eureka/", 应用端口

discoveryType 为 nacos时,config 参数共 5个,依次为:nacos地址, contextPath, nameSpaceID, nacosPort, appPort

func RegisterServiceInstance

func RegisterServiceInstance(param vo.RegisterInstanceParam)

Types

type Discovery

type Discovery interface {
	// GetInstance 从服务发现获取应用地址
	GetInstance(app string) (string, error)
}

type Eureka

type Eureka struct {
}

func CreateEureka

func CreateEureka(username, password, node, app string, port int) *Eureka

func (*Eureka) GetInstance

func (e *Eureka) GetInstance(serviceName string) (instance string, err error)

type Nacos

type Nacos struct {
}

func CreateNacos

func CreateNacos(node, contextPath, nameSpaceID, appName string, Port, appPort uint64) *Nacos

CreateNacos 初始化nacos 并将应用注册到nacos

func (*Nacos) GetAllService

func (n *Nacos) GetAllService(param vo.GetAllServiceInfoParam) model.ServiceList

func (*Nacos) GetInstance

func (n *Nacos) GetInstance(serviceName string) (string, error)

func (*Nacos) GetService

func (n *Nacos) GetService(param vo.GetServiceParam)

func (*Nacos) SelectAllInstances

func (n *Nacos) SelectAllInstances(param vo.SelectAllInstancesParam)

func (*Nacos) SelectInstances

func (n *Nacos) SelectInstances(param vo.SelectInstancesParam)

func (*Nacos) SelectOneHealthyInstance

func (n *Nacos) SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) *model.Instance

func (*Nacos) Subscribe

func (n *Nacos) Subscribe(param *vo.SubscribeParam)

func (*Nacos) UnSubscribe

func (n *Nacos) UnSubscribe(param *vo.SubscribeParam)

type Registry

type Registry struct {
	DiscoveryType Discovery
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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